Changes between Version 22 and Version 23 of ImplementAnalysisLocal
- Timestamp:
- Sep 19, 2024, 2:19:30 PM (2 months ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
ImplementAnalysisLocal
v22 v23 37 37 == Overview == 38 38 39 With Version 1.16 of PDAF we introduced PDAF-OMI (observation module infrastructure). With OMI we provide generic routines for the analysis step, which only distinguish global and local filters. This page describes the implementation of the analysis step for domain-local filters (LESTKF, LETKF, LNETF, LSEIK). 39 This page describes the recommended implementation of the analysis step of local filters with OMI using the PDAFlocal interface that was introduced with PDAF V2.3. The older approach calling PDAFomi_assimilate_local or PDAFomi_put_state_local is documented on the page on [wiki:ImplementAnalysisLocal Implementing the Analysis Step for the Local Filters with OMI without PDAFlocal (until V2.2.1 of PDAF)]. 40 41 PDAF-OMI provides generic routines for the analysis step, which only distinguish global and local filters. This page describes the implementation of the analysis step for domain-local filters (LESTKF, LETKF, LNETF, LSEIK). 40 42 41 43 For the analysis step of the local filters we need different operations related to the observations. These operations are requested by PDAF by call-back routines supplied by the user and provided in the OMI structure. The names of the routines that are provided by the user are specified in the call to the routine `PDAFomi_assimilate_local` in the fully-parallel implementation (or `PDAFomi_put_state_local` for the 'flexible' implementation) that was discussed before. With regard to the parallelization, all these routines (except `U_collect_state`, `U_distribute_state`, and `U_next_observation`) are executed by the filter processes (`filterpe=.true.`) only. … … 44 46 45 47 46 == `PDAF omi_assimilate_local` ==48 == `PDAFlocalomi_assimilate_local` == 47 49 48 50 The general aspects of the filter-specific routines `PDAF_assimilate_*` have been described on the page [ModifyModelforEnsembleIntegration Modification of the model code for the ensemble integration] and its sub-page on [InsertAnalysisStep inserting the analysis step]. 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. … … 53 55 The interface when using one of the local filters is the following: 54 56 {{{ 55 SUBROUTINE PDAF omi_assimilate_local(U_collect_state, U_distribute_state, &57 SUBROUTINE PDAFlocalomi_assimilate_local(U_collect_state, U_distribute_state, & 56 58 U_init_dim_obs_pdafomi, U_obs_op_pdafomi, & 57 59 U_prepoststep, U_init_n_domains, U_init_dim_l, & 58 U_init_dim_obs_l_pdafomi, U_g2l_state, U_l2g_state,&60 U_init_dim_obs_l_pdafomi, & 59 61 U_next_observation, status) 60 62 }}} … … 67 69 * [#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 68 70 * [#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 69 * [#U_init_dim_obs_l_pdafomicallback_obs_pdafomi.F90 U_init_dim_obs_l_pdafomi]: The name of the routine that initializes the size of the observation vector for a local analysis domain 70 * [#U_g2l_stateg2l_state_pdaf.F90 U_g2l_state]: The name of the routine that initializes a local state vector from the global state vector 71 * [#U_l2g_statel2g_state_pdaf.F90 U_l2g_state]: The name of the routine that initializes the corresponding part of the global state vector from the provided local state vector 71 * [#U_init_dim_obs_l_pdafomicallback_obs_pdafomi.F90 U_init_dim_obs_l_pdafomi]: The name of the routine that initializes the size of the observation vector for a local analysis domain and the index arrays used to map between the global state vector and the local state vector. 72 72 * [#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`. 73 73 * `status`: The integer status flag. It is zero, if `PDAFomi_assimilate_local` is exited without errors. … … 75 75 Note: 76 76 * The order of the routine names does not show the order in which these routines are executed. See the [#Executionorderofuser-suppliedroutines section on the order of the execution] at the bottom of this page. 77 78 79 80 == `PDAFomi_put_state_local` == 77 * If your code shows a call to `PDAFomi_assimilate_local`, it uses the implementation variant without PDAFlocal. This is documented on the page on [wiki:ImplementAnalysisLocal Implementing the Analysis Step for the Local Filters with OMI without PDAFlocal (until V2.2.1 of PDAF)]. 78 79 80 81 == `PDAFlocalomi_put_state_local` == 81 82 82 83 When the 'flexible' implementation variant is chosen for the assimilation system, the routine `PDAFomi_put_state_local` has to be used instead of `PDAFomi_assimilate_local`. 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 `PDAFomi_assimilate_local` with the exception the specification of the user-supplied routines `U_distribute_state` and `U_next_observation` are missing. … … 84 85 The interface when using one of the local filters is the following: 85 86 {{{ 86 SUBROUTINE PDAF omi_put_state_local(U_collect_state, &87 SUBROUTINE PDAFlocalomi_put_state_local(U_collect_state, & 87 88 U_init_dim_obs_pdafomi, U_obs_op_pdafomi, & 88 89 U_prepoststep, U_init_n_domains, U_init_dim_l, & 89 U_init_dim_obs_l_pdafomi, U_g2l_state, U_l2g_state,&90 U_init_dim_obs_l_pdafomi, & 90 91 status) 91 92 }}} 93 94 * If your code shows a call to `PDAFomi_put_state_local`, it uses the implementation variant without PDAFlocal. This is documented on the page on [wiki:ImplementAnalysisLocal Implementing the Analysis Step for the Local Filters with OMI without PDAFlocal (until V2.2.1 of PDAF)]. 92 95 93 96 == User-supplied routines == … … 167 170 The routine is called during the loop over the local analysis domains in the analysis step. 168 171 For PDAF it has to provide in `dim_l` the dimension of the state vector for the local analysis domain with index `domain_p`. 172 173 In addition, for PDAFlocal the routine has to provide the index array containing the indices of the elements of the local state vector in the global (or domain-decomposed) state vector to PDAFlocal by calling `PDAFlocal_set_indices'. (in the template files, this array is called `id_lstate_in_pstate`) 169 174 170 175 Hints: … … 178 183 * In this case, `dim_l` will be the number of vertical grid points at this location times the number of model fields that exist in the vertical, plus possible variables at e.g. the surface. 179 184 * In this case only the horizontal coordinates are used in `coords_l`. 180 * Further, we recommend to initialize an array containing the indices of the elements of the local state vector in the global (or domain-decomposed) state vector (`id_lstate_in_pstate` in the template files). This array is also shared through 'mod_assimilation'. 185 186 The index array `id_lstate_in_pstate` is an integer array in form of a one-dimensional vector. One initializes this vector by determining the indices of the elements of the local state vector in the global, or domain decomposed, state vector. After initializing `id_lstate_in_pstate`, one has to provided it to PDAFlocal by calling `PDAFlocal_set_indices'. The interface interface is: 187 188 {{{ 189 SUBROUTINE PDAFlocal_set_indices(dim_l, id_lstate_in_pstate) 190 191 INTEGER, INTENT(in) :: dim_l ! Dimension of local state vector 192 INTEGER, INTENT(in) :: id_lstate_in_pstate(dim_l) ! Index array for mapping 193 }}} 194 195 Hint for `id_lstate_in_pstate`: 196 * The initialization of the index vector `map` is analogous to a loop that directly performs the initialization of a local state vector. However, here only the indices are stored. 197 * See the [wiki:PDAFlocal_overview PDAFlocal overview page] for more information on the functionality of PDAFlocal. 181 198 182 199 … … 186 203 187 204 See the [wiki:OMI_Callback_obs_pdafomi documentation on callback_obs_pdafomi.F90] for more information. 188 189 190 === `U_g2l_state` (g2l_state_pdaf.F90) ===191 192 The interface for this routine is:193 {{{194 SUBROUTINE g2l_state(step, domain_p, dim_p, state_p, dim_l, state_l)195 196 INTEGER, INTENT(in) :: step ! Current time step197 INTEGER, INTENT(in) :: domain_p ! Current local analysis domain198 INTEGER, INTENT(in) :: dim_p ! State dimension for model sub-domain199 INTEGER, INTENT(in) :: dim_l ! Local state dimension200 REAL, INTENT(in) :: state_p(dim_p) ! State vector for model sub-domain201 REAL, INTENT(out) :: state_l(dim_l) ! State vector on local analysis domain202 }}}203 204 The routine is called during the loop over the local analysis domains in the analysis step. It has to provide the local state vector `state_l` that corresponds to the local analysis domain with index `domain_p`. Provided to the routine is the state vector `state_p`. With a domain decomposed model, this is the state for the local model sub-domain.205 206 Hints:207 * In the simple case that a local analysis domain is a single vertical column of the model grid, the operation in this routine would be to take out of `state_p` the data for the vertical column indexed by `domain_p`.208 * Usually, one can use the index array `id_lstate_in_pstate`, which is initialized in `U_init_dim_l`. The array holds the indices of the local state vector elements in the global state vector.209 210 211 === `U_l2g_state` (l2g_state_pdaf.F90) ===212 213 The interface for this routine is:214 {{{215 SUBROUTINE l2g_state(step, domain_p, dim_l, state_l, dim_p, state_p)216 217 INTEGER, INTENT(in) :: step ! Current time step218 INTEGER, INTENT(in) :: domain_p ! Current local analysis domain219 INTEGER, INTENT(in) :: dim_p ! State dimension for model sub-domain220 INTEGER, INTENT(in) :: dim_l ! Local state dimension221 REAL, INTENT(in) :: state_p(dim_p) ! State vector for model sub-domain222 REAL, INTENT(out) :: state_l(dim_l) ! State vector on local analysis domain223 }}}224 225 The routine is called during the loop over the local analysis domains in the analysis step. It has to initialize the part of the global state vector `state_p` that corresponds to the local analysis domain with index `domain_p`. Provided to the routine is the state vector `state_l` for the local analysis domain.226 227 Hints:228 * In the simple case that a local analysis domain is a single vertical column of the model grid, the operation in this routine would be to write into `state_p` the data for the vertical column indexed by `domain_p`.229 * Usually, one can use the index array `id_lstate_in_pstate`, which is initialized in `U_init_dim_l`. The array holds the indices of the local state vector elements in the global state vector.230 205 231 206 … … 253 228 1. [#U_init_dim_linit_dim_l_pdaf.F90 U_init_dim_l] 254 229 1. [#U_init_dim_obs_l_pdafomiinit_dim_obs_l_pdaf.F90 U_init_dim_obs_l_pdafomi] 255 1. [#U_g2l_stateg2l_state_pdaf.F90 U_g2l_state] (Called `dim_ens+1` times: Once for each ensemble member and once for the mean state estimate)256 1. [#U_l2g_statel2g_state_pdaf.F90 U_l2g_state] (Called `dim_ens+1` times: Once for each ensemble member and once for the mean state estimate)257 230 258 231 After the loop over all local analysis domains, it is executed: