Changes between Version 25 and Version 26 of ImplementAnalysisestkf


Ignore:
Timestamp:
Jun 3, 2025, 7:25:38 PM (2 days ago)
Author:
lnerger
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • ImplementAnalysisestkf

    v25 v26  
    5151== Overview ==
    5252
    53 The ESTKF [Error Subspace Transform Kalman Filter] algorithm was introcued with PDAF V1.8.. The user-supplied routines required for the ESTKF are identical to those required for the SEIK filter and amost identical to those required for the ETKF method.
    54 
    55 For the analysis step of the ESTKF different operations related to the observations are needed. These operations are requested by PDAF by call-back routines supplied by the user. Intentionally, the operations are split into separate routines in order to keep the operations rather elementary and efficient. This procedure should simplify the implementation. The names of the required routines are specified in the call to the routine `PDAF_assimilate_estkf` in the fully-parallel implementation (or `PDAF_put_state_estkf` for the 'flexible' implementation) that was discussed before. With regard to the parallelization, all these routines are executed by the filter processes (`filterpe=.true.`) only.
    56 
    57 For completeness we discuss here all user-supplied routines that are specified in the interface to PDAF_assimilate_estkf. Thus, some of the user-supplied routines that are explained on the page describing the modification of the model code for the ensemble integration are repeated here.
     53The ESTKF [Error Subspace Transform Kalman Filter] algorithm was introcued with PDAF V1.8. The user-supplied routines required for the ESTKF are identical to those required for the SEIK filter and amost identical to those required for the ETKF method.
     54
     55For the analysis step of the ESTKF, different operations related to the observations are needed. These operations are requested by PDAF by call-back routines supplied by the user. Intentionally, the operations are split into separate routines in order to keep the operations rather elementary and efficient. This procedure should simplify the implementation. The names of the required routines are specified in the call to the routine `PDAF_assimilate_estkf` in the ''fully-parallel'' and ''flexible'' implementation (or `PDAF_put_state_estkf` for the offlie mode and the ''flexible'' implementation in PDAF2) that was discussed before. For the offline mode in PDAF3, the routine `PDAF_assim_offline_estkf` is used. With regard to the parallelization, all these routines are executed by the filter processes (`filterpe=.true.`) only.
     56
     57For completeness we discuss here all user-supplied routines that are specified in the interface to `PDAF_assimilate_estkf`. Thus, some of the user-supplied routines that are explained on the page describing the modification of the model code for the ensemble integration are repeated here.
    5858
    5959The ESTKF and the ETKF (Ensemble Transform Kalman Filter) are very similar. For this reason, the interface to the user-supplied routines is almost identical. Depending on the implementation it can be possible to use identical routines for the ESTKF and the ETKF. Differences are marked in the text below.
     
    6161== `PDAF_assimilate_estkf` ==
    6262
    63 The general aspects of the filter-specific routines `PDAF_assimilate_*` have been described on the page [wiki:OnlineModifyModelforEnsembleIntegration_PDAF3 Modification of the model code for the ensemble integration].  The routine is used in the fully-parallel implementation variant of the data assimilation system. When the 'flexible' implementation variant is used, the routines `PDAF_put_state_*' is used as described further below. Here, we list once more the full interface of the routine. Subsequently, the full set of user-supplied routines specified in the call to `PDAF_assimilate_estkf` is explained.
    64 
    65 The interface when using the ESTKF is the following:
     63This routine is used both in the ''fully-parallel'' and the ''flexible'' implementation variants of the data assimilation system. (See the page [wiki:OnlineModifyModelforEnsembleIntegration_PDAF3 Modification of the model code for the ensemble integration] for these variants)
     64
     65Here, we list the full interface of the routine. Subsequently, the user-supplied routines specified in the call are explained.
     66
     67The interface is:
    6668{{{
    6769  SUBROUTINE PDAF_assimilate_estkf(U_collect_state, U_distribute_state, U_init_dim_obs, &
     
    8082 * [#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`.
    8183 * `status`: The integer status flag. It is zero, if `PDAF_assimilate_estkf` is exited without errors.
    82 
     84where all arguments, except the last one, are names of used-supplied routines.
     85
     86
     87=== `PDAF_assim_offline_estkf ` ===
     88
     89For the offline mode of PDAF, the routine `PDAF3_assim_offline` is used to perform the analysis step.
     90The interface of the routine is identical with that of `PDAF_assimilate_estkf`, except that the user-supplied routines `U_distribute_state`, `U_collect_state` and `U_next_observation` are missing.
     91
     92The interface is:
     93{{{
     94  SUBROUTINE PDAF_assim_offline_estkf(U_init_dim_obs, &
     95                                 U_obs_op, U_init_obs, U_prepoststep, U_prodRinvA, &
     96                                 U_init_obsvar, status)
     97}}}
    8398
    8499== `PDAF_put_state_estkf` ==
    85100
    86 When the 'flexible' implementation variant is chosen for the assimilation system, the routine `PDAF_put_state_estkf` has to be used instead of `PDAF_assimilate_estkf`. The general aspects of the filter specific routines `PDAF_put_state_*` have been described on the page [wiki:OnlineModifyModelforEnsembleIntegration_PDAF3 Modification of the model code for the ensemble integration]. The interface of the routine is identical with that of `PDAF_assimilate_estkf` with the exception the specification of the user-supplied routines `U_distribute_state` and `U_next_observation` are missing.
     101This routine exists for backward-compatibility. In implementations that were done before the release of PDAF V3.0, a 'put_state' routine was used for the `flexible` parallelization variant and for the offline mode.
     102When the 'flexible' implementation variant is chosen for the assimilation system, the routine. This routine allows to continue using the previous implementation structure.
     103The interface of the routine is identical with that of `PDAF_assimilate_estkf`, except that the user-supplied routines `U_distribute_state` and `U_next_observation` are missing.
    87104
    88105The interface when using the ESTKF is the following:
     
    175192=== `U_prepoststep` (prepoststep_ens_pdaf.F90) ===
    176193
    177 The routine has already been described on the [wiki:OnlineModifyModelforEnsembleIntegration_PDAF3#prepoststep_pdafprepoststep_ens_pdaf.F90 page on modifying the model code for the ensemble integration]. For completeness, the description is repeated:
    178 
    179 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.
    180 
    181 The interface for this routine is
    182 {{{
    183 SUBROUTINE prepoststep(step, dim_p, dim_ens, dim_ens_p, dim_obs_p, &
    184                        state_p, Uinv, ens_p, flag)
    185 
    186   INTEGER, INTENT(in) :: step        ! Current time step
    187                          ! (When the routine is called before the analysis -step is provided.)
    188   INTEGER, INTENT(in) :: dim_p       ! PE-local state dimension
    189   INTEGER, INTENT(in) :: dim_ens     ! Size of state ensemble
    190   INTEGER, INTENT(in) :: dim_ens_p   ! PE-local size of ensemble
    191   INTEGER, INTENT(in) :: dim_obs_p   ! PE-local dimension of observation vector
    192   REAL, INTENT(inout) :: state_p(dim_p) ! PE-local forecast/analysis state
    193                                      ! The array 'state_p' is not generally not initialized in the case of SEIK/EnKF/ETKF/ESTKF.
    194                                      ! It can be used freely in this routine.
    195   REAL, INTENT(inout) :: Uinv(dim_ens-1, dim_ens-1) ! Inverse of matrix U
    196   REAL, INTENT(inout) :: ens_p(dim_p, dim_ens)      ! PE-local state ensemble
    197   INTEGER, INTENT(in) :: flag        ! PDAF status flag
    198 }}}
    199 
    200 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`).
    201 
    202 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.
    203 
    204 Hint:
    205  * If a user considers to perform adjustments to the estimates (e.g. for balances), this routine is the right place for it.
    206  * 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`.
    207  * The interface has a difference for ETKF and ESTKF: 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 ESTKF. (For most cases, this will be irrelevant, because most usually the ensemble array `ens_p` is used for computations, rather than `Uinv`. Only for the SEIK filter with fixed covariance matrix, `Uinv` is required to compute the estimate analysis error. The fixed covariance matrix mode is not available for the ETKF or ESTKF.)
    208  * The interface through which `U_prepoststep` is called does not include the array of smoothed ensembles. In order to access the smoother ensemble array one has to set a pointer to it using a call to the routine `PDAF_get_smootherens` (see page on [AuxiliaryRoutines auxiliary routines])
     194The routine has already been described for modifying the model for the ensemble integration and for inserting the analysis step.
     195
     196See the page on [wiki:OnlineModifyModelforEnsembleIntegration_PDAF3#distribute_state_pdafdistribute_state_pdaf.F90 modifying the model code for the ensemble integration] for the description of this routine.
    209197
    210198
    211199=== `U_prodRinvA` (prodrinva_pdaf.F90) ===
    212200
    213 This routine is used by all filter algorithms that use the inverse of the observation error covariance matrix (SEEK, SEIK, ETKF, ESTKF).
     201This routine is used by all filter algorithms that use the inverse of the observation error covariance matrix (SEEK, SEIK, ETKF, ESTKF, but also 3DEnVar and hybrid 3D-Var).
    214202
    215203The interface for this routine is: