PDAFlocal_set_indices
This page documents the routine PDAFlocal_set_indices
of PDAF, which is used with the PDAFlocal interface. This routine was introduced with PDAF V2.3.
This routine is called in init_dim_l_pdaf
when the dimension of the local state vector has to be determined. In addition to this dimension, the implementation guide recommends to also initialize the coordinates of the local analysis domain and the indices of the elements ofthe local state vector in the non-localized (global or domain-decomposed) state vector state_p
. Thise indices are then used in the mapping from the global to the local state vector before the analysis and back after the analysis update in the local analysis loop. With PDAFlocal, one uses PDAFlocal_set_indices
to pass the vector of indices to PDAFlocal, which later performs the mapping for all ensemble states.
The interface is:
SUBROUTINE PDAFlocal_set_indices(dim_l, map) INTEGER, INTENT(in) :: dim_l ! Dimension of local state vector INTEGER, INTENT(in) :: map(dim_l) ! Index array for mapping
Hints:
- For complex cases it might feel more intuitive to perform the mapping between the global and local state vectors in an explicit loop. However, this might lead to repeated computation of the indices and can hence be less efficient than computing the indices before.
- The initialization of hthe 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. - One can call this routine again to change the weights. One does not need to call PDAFlocal_clear_increment_weights before. In any case, one has to be careful to ensure that the size of
weights
remains consistent when the size of the local state vector changes.