Changes between Version 61 and Version 62 of ImplementAnalysislseik


Ignore:
Timestamp:
Jun 4, 2025, 10:42:03 AM (2 days ago)
Author:
lnerger
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • ImplementAnalysislseik

    v61 v62  
    4343== Overview ==
    4444
     45The localized SEIK filter (Nerger et al., 2005) is an efficient ensemble-based error-subspace filter. We generally recommend to avoid using it, since the ensemble representation can be suboptimal as was described by Nerger et al., 2012. We recommend to use instead the [wiki:ImplementAnalysisestkf LESTKF (local error subspace transform Kalman filter)] or [wiki:ImplementAnalysisletkf LESTKF (Local ensemble transform Kalman filter)].
     46
    4547For the analysis step of the LSEIK filter, several operations related to the observations are needed. These operations are requested by PDAF by calling user-supplied routines. Intentionally, the operations are split into separate routines in order to keep the operations rather elementary as this procedure should simplify the implementation. The names of the required routines are specified in the call to the routine `PDAF_assimilate_lseik` (or `PDAF_put_state_lseik`) described below. With regard to the parallelization, all these routines (except `U_collect_state`, `U_distribute_state`, and zU_next_observation`) are executed by the filter processes (`filterpe=.true.`) only.
    4648
     
    5254== `PDAF_assimilate_lseik` ==
    5355
    54 The general espects 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].
    55 The interface for the routine `PDAF_assimilate_lseik` contains several routine names for routines that operate on the local analysis domains (marked by `_l` at the end of the routine name). In addition, there are names for routines that consider all available observations required to perform local analyses with LSEIK within some sub-domain of a domain-decomposed model (marked by `_f` at the end of the routine name). In case of a serial execution of the assimilation program, these will be all globally available observations. However, if the program is executed with parallelization, this might be a smaller set of observations.
    56 
    57 To explain the  difference, it is assumed, for simplicity, that a local analysis domain consists of a single vertical column of the model grid. In addition, we assume that the domain decomposition splits the global model domain by vertical boundaries as is typical for ocean models and that the observations are spatially distributed observations of model fields that are part of the state vector.  Under these assumptions, the situation is the following: When a model uses domain decomposition, the LSEIK filter is executed such that for each model sub-domain a loop over all local analysis domains (e.g. vertical columns) that belong to the model sub-domain is performed. As each model sub-domain is treated by a different process, all loops are executed parallel to each other.
    58 
    59 For the update of each single vertical column, observations from some larger domain surrounding the vertical column are required. If the influence radius for the observations is sufficiently small there will be vertical columns for which the relevant observations reside completely inside the model sub-domain of the process. However, if a vertical column is considered that is located close to the boundary of the model sub-domain, there will be some observations that don't belong spatially to the local model sub-domain, but to a neighboring model sub-domain. Nonetheless, these observations are required on the local model sub-domain. A simple way to handle this situation is to initialize for each process all globally available observations, together with their coordinates. While this method is simple, it can also become inefficient if the assimilation program is executed using a large number of processes. As for an initial implementation it is usually not the concern to obtain the highest parallel efficiency, the description below assumes that 'full' refers to the global model domain.
    60 
    61 The interface when using the LSEIK filter is the following:
    62 {{{
    63   SUBROUTINE PDAF_assimilate_lseik(U_collect_state, U_distribute_state, U_init_dim_obs_f, U_obs_op_f, &
    64                                   U_init_obs_f, U_init_obs_l, U_prepoststep, U_prodRinvA_l, &
     56This 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)
     57
     58The interface for the routine `PDAF_assimilate_lseik` contains several routine names for routines that operate on the local analysis domains (marked by `_l` at the end of the routine name). In addition, there are names for routines that consider all available observations required to perform local analyses with LSEIK within some sub-domain of a domain-decomposed model (we refer to these as 'full' observations, marked by `_f` at the end of the routine name). In case of a serial execution of the assimilation program, these will be all globally available observations. However, if the program is executed with parallelization, one might choose a smaller set of observations. We will explain this is some detail below.
     59
     60Here, we list the full interface of the routine. Subsequently, the user-supplied routines specified in the call are explained.
     61
     62The interface is:
     63{{{
     64  SUBROUTINE PDAF_assimilate_lseik(U_collect_state, U_distribute_state, &
     65                                  U_init_dim_obs_f, U_obs_op_f, U_init_obs_f, &
     66                                  U_init_obs_l, U_prepoststep, U_prodRinvA_l, &
    6567                                  U_init_n_domains, U_init_dim_l, U_init_dim_obs_l, &
    6668                                  U_g2l_state, U_l2g_state, U_g2l_obs, &
     
    9193
    9294
     95
     96== `PDAF_assim_offline_lestkf ` ==
     97
     98This routine is used to perform the analysis step for the offline mode of PDAF.
     99The interface of the routine is identical with that of the 'assimilate'-routine, except that the user-supplied routines `U_distribute_state`, `U_collect_state` and `U_next_observation` are missing.
     100
     101The 'assim_offline' routines were introduced with PDAF V3.0 to simplify the [wiki:OfflineImplementationGuide_PDAF3 implementation of the offline mode].
     102
     103The interface is:
     104{{{
     105  SUBROUTINE PDAF_assim_offline_lseik(&
     106                                  U_init_dim_obs_f, U_obs_op_f, U_init_obs_f, &
     107                                  U_init_obs_l, U_prepoststep, U_prodRinvA_l,  &
     108                                  U_init_n_domains, U_init_dim_l, U_init_dim_obs_l, &
     109                                  U_g2l_state, U_l2g_state, U_g2l_obs, &
     110                                  U_init_obsvar, U_init_obsvar_l, status)
     111}}}
     112
     113
    93114== `PDAF_put_state_lseik` ==
    94115
    95 When the 'flexible' implementation variant is chosen for the assimilation system, the routine `PDAF_put_state_lseik` has to be used instead of `PDAF_assimilate_lseik`. 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_lseik` with the exception the specification of the user-supplied routines `U_distribute_state` and `U_next_observation` are missing.
    96 
    97 The interface when using the LSEIK filter is the following:
     116This routine exists for backward-compatibility. In implementations that were done for PDAF V2.3.1 and before, a 'put_state' routine was used for the [wiki:OnlineFlexible_PDAF3 'flexible' parallelization variant] and for the [wiki:OfflineImplementationGuide_PDAF3 offline mode].  This routine allows to continue using the previous implementation structure.
     117The interface of the routine is identical with that of the 'assimilate'-routine, except that the user-supplied routines `U_distribute_state` and `U_next_observation` are missing.
     118
     119The interface is:
    98120{{{
    99121  SUBROUTINE PDAF_put_state_lseik(U_collect_state, U_init_dim_obs_f, U_obs_op_f, U_init_obs_f, &
     
    104126}}}
    105127
     128== Explanation of 'full observations' ==
     129
     130Above we mention the concept of 'full' observations. We distinguish them from the globally available observations for efficiency.
     131
     132Note: For an initial implementation, one might not needd to worry about high efficiency, so that 'full' can refer to all available observations.
     133
     134To explain why 'full' observations can be different from globally available observations, we assume, for simplicity, that  we have a 2-dimensional domain and that a local analysis domain consists of a single grid point of the model grid. In addition, we assume that the domain decomposition splits the global model domain in compact sub-domains and that the observations are spatially distributed observations of model fields that are part of the state vector. 
     135
     136The LESTKF performs a loop over all local analysis domains, i.e. grid points.  When a model uses domain decomposition, the loop is over all grid points that belong to a process sub-domain. As each model sub-domain is treated by a different process, all loops are executed parallel to each other.
     137
     138For the update of each local analysis domain (grid points), observations within the localization radius around its location are required. If the influence radius for the observations is sufficiently small, there will be grid points a for which the relevant observations reside completely inside the model sub-domain of the process. However, if a grid point is located close to the boundary of the model sub-domain, there will be some observations that reside on a neighboring process sub-domain, but are within the localization radius. One needs to assimilate these observations as otherwise, there could be unrealistic steps in the analysis field. However, there will also be observations that reside far away from the process sub-domain and will never influence the analysis result in this domain.
     139
     140A simple way to handle this situation is to initialize for each process all globally available observations, together with their coordinates. The observation operator would be applied on each sub-domain and then the observed ensemble would be collect using parallel communication with MPI. While this method is simple, it can also become inefficient if the assimilation program is executed using a large number of processes. In particular, all observation would need to be checked even if they are far away from the process sub-domain.
     141
     142More efficient is hence to select as 'full' observations only those observations that can have an effect on the local analyses of a process sub-domain. These are the observations that reside within the sub-domain, plus observations in neighboring sub-domains that reside within the localization radius. Setting up 'full' observations in this way leads to a smaller number of observations whose distance need to be checked for each local analysis domain. Howeever, one would need to find an implementation that provides the 'full' observations.
     143
     144|| Note: The handling of 'full' observations is one of the aspects that motivated the development of PDAF-OMI and the relaed avanced interface (now the PDAF3 interface). Here, PDAF-OMI does take case of the 'full' observations. See the [wiki:ImplementationofAnalysisStep_PDAF3 Implementation Guide for the Analysis Step for the advanced interface using PDAF-OMI]. ||
     145
     146
    106147== User-supplied routines ==
    107148
    108 Here, all user-supplied routines are described that are required in the call to `PDAF_assimilate_lseik`. For some of the generic routines, we link to the page on [wiki:OnlineModifyModelforEnsembleIntegration_PDAF3 modifying the model code for the ensemble integration].
     149Here, all user-supplied routines are described that are required in the calls to the analysis routines. For some of the generic routines, we link to the page on [wiki:OnlineModifyModelforEnsembleIntegration_PDAF3 modifying the model code for the ensemble integration].
    109150
    110151To indicate user-supplied routines we use the prefix `U_`. In the tutorials in `tutorial/` and in the template directory `templates/` these routines exist without the prefix, but with the extension `_pdaf`. The files are named correspondingly. In the section titles below we provide the name of the template file in parentheses.
     
    114155=== `U_collect_state` (collect_state_pdaf.F90) ===
    115156
    116 This routine is independent from the filter algorithm used.
    117 See the mape on [wiki:OnlineModifyModelforEnsembleIntegration_PDAF3#U_collect_statecollect_state_pdaf.F90 inserting the analysis step] for the description of this routine.
     157This routine is independent of the filter algorithm used.
     158See the page on [wiki:OnlineModifyModelforEnsembleIntegration_PDAF3#collect_state_pdafcollect_state_pdaf.F90 modifying the model code for the ensemble integration] for the description of this routine.
     159
    118160
    119161=== `U_distribute_state` (distribute_state_pdaf.F90) ===
    120162
    121163This routine is independent of the filter algorithm used.
    122 See the page on [wiki:OnlineModifyModelforEnsembleIntegration_PDAF3#U_distribute_statedistribute_state_pdaf.F90 inserting the analysis step] for the description of this routine.
     164See 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.
    123165
    124166
     
    206248=== `U_prepoststep` (prepoststep_ens_pdaf.F90) ===
    207249
    208 This routine can be identical to that used for the global SEIK filter, which has already been described on the [wiki:OnlineModifyModelforEnsembleIntegration_PDAF3#U_prepoststepprepoststep_ens_pdaf.F90 page on modifying the model code for the ensemble integration]. For completeness, the description is repeated:
    209 
    210 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.
    211 
    212 The interface for this routine is
    213 {{{
    214 SUBROUTINE prepoststep(step, dim_p, dim_ens, dim_ens_p, dim_obs_p, &
    215                        state_p, Uinv, ens_p, flag)
    216 
    217   INTEGER, INTENT(in) :: step        ! Current time step
    218                          ! (When the routine is called before the analysis -step is provided.)
    219   INTEGER, INTENT(in) :: dim_p       ! PE-local state dimension
    220   INTEGER, INTENT(in) :: dim_ens     ! Size of state ensemble
    221   INTEGER, INTENT(in) :: dim_ens_p   ! PE-local size of ensemble
    222   INTEGER, INTENT(in) :: dim_obs_p   ! PE-local dimension of observation vector
    223   REAL, INTENT(inout) :: state_p(dim_p) ! PE-local forecast/analysis state
    224                                      ! The array 'state_p' is not generally not initialized in the case of SEIK/EnKF/ETKF.
    225                                      ! It can be used freely in this routine.
    226   REAL, INTENT(inout) :: Uinv(dim_ens-1, dim_ens-1) ! Inverse of matrix U
    227   REAL, INTENT(inout) :: ens_p(dim_p, dim_ens)      ! PE-local state ensemble
    228   INTEGER, INTENT(in) :: flag        ! PDAF status flag
    229 }}}
    230 
    231 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`).
    232 
    233 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.
    234 
    235 Hint:
    236  * If a user considers to perform adjustments to the estimates (e.g. for balances), this routine is the right place for it.
    237  * 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`.
    238  * 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.
    239 
     250The routine has already been described for modifying the model for the ensemble integration and for inserting the analysis step.
     251
     252See 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.
    240253
    241254
     
    446459
    447460This routine is independent of the filter algorithm used.
    448 See the page on [wiki:OnlineModifyModelforEnsembleIntegration_PDAF3#U_next_observationnext_observation_pdaf.F90 inserting the analysis step] for the description of this routine.
     461See the page on [wiki:OnlineModifyModelforEnsembleIntegration_PDAF3#next_observation_pdafnext_observation_pdaf.F90 modifying the model code for the ensemble integration] for the description of this routine.
    449462
    450463