Changes between Version 1 and Version 2 of ImplementAnalysislknetf


Ignore:
Timestamp:
Feb 19, 2023, 9:45:40 AM (14 months ago)
Author:
lnerger
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • ImplementAnalysislknetf

    v1 v2  
    6262       U_g2l_state, U_l2g_state, U_g2l_obs, U_init_obsvar, U_init_obsvar_l, &
    6363       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)
    6964}}}
    7065with the following arguments:
     
    7772 * [#U_prepoststepprepoststep_ens_pdaf.F90 U_prepoststep]: The name of the pre/poststep routine as in `PDAF_get_state`
    7873 * [#U_prodRinvA_lprodrinva_l_pdaf.F90 U_prodRinvA_l]: The name of the user-supplied 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 user-supplied 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.
    7975 * [#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
    8076 * [#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
     
    8480 * [#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
    8581 * [#U_init_obsvarinit_obsvar_pdaf.F90 U_init_obsvar]: The name of the user-supplied 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 user-supplied 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 user-supplied 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.
    8684 * [#U_init_obsvar_linit_obsvar_l_pdaf.F90 U_init_obsvar_l]: The name of the user-supplied 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)
    8785 * [#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_letkf` is exited without errors.
     86 * `status`: The integer status flag. It is zero, if `PDAF_assimilate_lknetf` is exited without errors.
    8987
    9088Note:
     
    9290
    9391
    94 == `PDAF_put_state_letkf` ==
    95 
    96 When the 'flexible' implementation variant is chosen for the assimilation system, the routine `PDAF_put_state_letkf` 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 user-supplied routines `U_distribute_state` and `U_next_observation` are missing.
    97 
    98 The interface when using the LETKF algorithm is the following:
    99 {{{
    100   SUBROUTINE PDAF_put_state_letkf(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                                  U_init_dim_l, U_init_dim_obs_l, &
    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
     94When 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 user-supplied routines `U_distribute_state` and `U_next_observation` are missing.
     95
     96The 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)
    105103}}}
    106104
     
    108106== User-supplied routines ==
    109107
    110 Here, all user-supplied routines are described that are required in the call to `PDAF_assimilate_letkf`. For some of the generic routines, we link to the page on [ModifyModelforEnsembleIntegration modifying the model code for the ensemble integration].
     108Here, all user-supplied 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].
    111109
    112110To indicate user-supplied 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.
     
    127125=== `U_init_dim_obs_f` (init_dim_obs_f_pdaf.F90) ===
    128126
    129 This routine is used by all filter algorithms with domain-localization (LSEIK, LETKF) and is independent of the particular algorithm.
     127This routine is used by all filter algorithms with domain-localization and is independent of the particular algorithm.
    130128
    131129The interface for this routine is:
     
    145143=== `U_obs_op_f` (obs_op_f_pdaf.F90) ===
    146144
    147 This routine is used by all filter algorithms with domain-localization (LSEIK, LETKF) and is independent of the particular algorithm.
     145This routine is used by all filter algorithms with domain-localization and is independent of the particular algorithm.
    148146
    149147The interface for this routine is:
     
    165163=== `U_init_obs_f` (init_obs_f_pdaf.F90) ===
    166164
    167 This routine is used by all filter algorithms with domain-localization (LSEIK, LETKF) and is independent of the particular algorithm.
     165This routine is used by all filter algorithms with domain-localization and is independent of the particular algorithm.
    168166The 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)
    169167
     
    186184=== `U_init_obs_l` (init_obs_l_pdaf.F90) ===
    187185
    188 This routine is used by all filter algorithms with domain-localization (LSEIK, LETKF) and is independent of the particular algorithm.
     186This routine is used by all filter algorithms with domain-localization and is independent of the particular algorithm.
    189187
    190188The interface for this routine is:
     
    202200
    203201Hints:
    204  * For parallel efficiency, the LETKF 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.
    205203 * 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.
    206204
     
    245243=== `U_prodRinvA_l` (prodrinva_l_pdaf.F90) ===
    246244
    247 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.
     245This 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.
    248246
    249247The interface for this routine is:
     
    271269
    272270
     271
     272=== `U_prodRinvA_hyb_l` (prodrinva_hyb_l_pdaf.F90) ===
     273
     274This routine is used by the local hybrid filter LKNETF.
     275
     276The interface for this routine is:
     277{{{
     278SUBROUTINE 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
     290The 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
     292This 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
     294The 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
     296Hints:
     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
    273299=== `U_init_n_domains` (init_n_domains_pdaf.F90) ===
    274300
    275 This routine is used by all filter algorithms with domain-localization (LSEIK, LETKF) and is independent of the particular algorithm.
     301This routine is used by all filter algorithms with domain-localization and is independent of the particular algorithm.
    276302
    277303The interface for this routine is:
     
    292318=== `U_init_dim_l` (init_dim_l_pdaf.F90) ===
    293319
    294 This routine is used by all filter algorithms with domain-localization (LSEIK, LETKF) and is independent of the particular algorithm.
     320This routine is used by all filter algorithms with domain-localization and is independent of the particular algorithm.
    295321
    296322The interface for this routine is:
     
    312338=== `U_init_dim_obs_l` (init_dim_obs_l_pdaf.F90) ===
    313339
    314 This routine is used by all filter algorithms with domain-localization (LSEIK, LETKF) and is independent of the particular algorithm.
     340This routine is used by all filter algorithms with domain-localization and is independent of the particular algorithm.
    315341
    316342The interface for this routine is:
     
    335361=== `U_g2l_state` (g2l_state_pdaf.F90) ===
    336362
    337 This routine is used by all filter algorithms with domain-localization (LSEIK, LETKF) and is independent of the particular algorithm.
     363This routine is used by all filter algorithms with domain-localization and is independent of the particular algorithm.
    338364
    339365The interface for this routine is:
     
    357383=== `U_l2g_state` (l2g_state_pdaf.F90) ===
    358384
    359 This routine is used by all filter algorithms with domain-localization (LSEIK, LETKF) and is independent of the particular algorithm.
     385This routine is used by all filter algorithms with domain-localization and is independent of the particular algorithm.
    360386
    361387The interface for this routine is:
     
    379405=== `U_g2l_obs` (g2l_obs_pdaf.F90) ===
    380406
    381 This routine is used by all filter algorithms with domain-localization (LSEIK, LETKF) and is independent of the particular algorithm.
     407This routine is used by all filter algorithms with domain-localization and is independent of the particular algorithm.
    382408
    383409The interface for this routine is:
     
    402428=== `U_init_obsvar` (init_obsvar_pdaf.F90) ===
    403429
    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.
     430This routine is used by the global and local square-root 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.
    405431
    406432The interface for this routine is:
     
    426452=== `U_init_obsvar_l` (init_obsvar_l_pdaf.F90) ===
    427453
    428 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).
     454This routine is used by all filter algorithms with domain-localization 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).
    429455
    430456The interface for this routine is:
     
    479505 1. [#U_prepoststepprepoststep_ens_pdaf.F90 U_prepoststep] (Call to act on the analysis ensemble, called with (positive) value of the time step)
    480506
    481 In case of the routine `PDAF_assimilate_letkf`, the following routines are executed after the analysis step:
     507In case of the routine `PDAF_assimilate_lknetf`, the following routines are executed after the analysis step:
    482508 1. [#U_distribute_statedistribute_state_pdaf.F90 U_distribute_state]
    483509 1. [#U_next_observationnext_observation_pdaf.F90 U_next_observation]