• Aucun résultat trouvé

Navigation on unstructured grids

Dans le document THÈSE DE DOCTORAT (Page 108-112)

Résumé

A cause de ses structures irrégulières les maillages non-structurés requièrent des méthodes adaptées pour déterminer les voisinages des cellules. Dans ce chapitre on décrit l’utilisation de structure de données sur arbre k-d permettant d’effectuer la recherche efficace de voisinages sur les maillages non-structurés.

The term “navigation” in this work is applied to describe the number of searching operations applied to unstructured grids which arise in several different contexts. Although DGM-based theoretical models for simulation do not mention these methods explicitly, assembling a simulation algorithm without them seems unrealistic. The following list mentions some important searching operations required by a simulation algorithm on unstructured grids:

a) determining for each conditioning data point the block of the grid that contains this point (which is required by conditioning procedures)

b) determining the closest data points for every block (required by conditioning through kriging)

c) determining the neighborhood for every block (required by SGS procedure) d) determining all blocks which are correlated with a given block (required for

optimization of computing the block to block covariance matrix, used for Gibbs Propagation algorithm).

In the general case, one cannot determine the neighborhood of a given block on an unstructured grid from the index of this block (as in the case of regular 𝐼𝐽𝐾 grids), so the algorithms used on regular grids, such as spiral search are not applicable to unstructured grids. It is also evident that direct lookup through all the (𝑁𝑏−1) blocks of the grid in order to determine the closest 𝑚 neighbors of a selected block 𝑣𝑝 is extremely inefficient. Indeed, determining the closest 𝑚 neighbors for every block by direct lookup is a 𝑂�𝑁𝑏2� in time. This result can be significantly improved with the use of k-d trees (Bentley 1975; Friedman et al. 1977), which enable searching for closest neighbors in proven 𝑂(log𝑁𝑏) time. Application of k-d tree to the problem described above (determining the closest 𝑚 neighbors for each block of the grid) leads to a 𝑂(𝑁𝑏log𝑁𝑏) algorithm, which is a significant improvement compared to the direct lookup through all the blocks.

Search trees were applied for navigation problems on regular and unstructured grids in geostatistical context (Boisvert & Deutsch 2010) for a similar to range of problems as discussed above. For searching problems in which the set of nodes on which the search is performed remains fixed (such as searching of the kriging neighborhoods), application of the optimal k-d tree (Bentley 1975) is the solution of choice. As demonstrated by Boisvert and Deutsch (2010), it outperforms the superblock search approach (Deutsch & Journel 1992). The situation is different

108 when the neighborhood search is applied to a set of blocks which is changing in time, as in the problem of finding the closest previously simulated blocks in the SGS procedure. Boisvert and Deutsch (2010) propose using k-d tree for the problem of SGS neighborhood search, organizing all 𝑁𝑏 blocks in the tree, but marking the previously simulated nodes as “informed”, and performing the search only through the “informed” nodes. The disadvantage of this approach is that on the first iterations of SGS the k-d tree contains mostly “non-informed” nodes, and many of them have to be scanned in order to find the desired neighborhood. We propose an alternative solution to this problem – constructing the k-d tree dynamically from the previously simulated nodes. In the proposed approach, on the first iteration of SGS the k-d search tree is empty, and every time a new grid block is simulated, it is inserted into the k-d search tree (the insertion operation is 𝑂(𝑡𝑟𝑒𝑒 ℎ𝑖𝑔ℎ𝑡) in complexity). The construction by this way may not be optimal in the sense of Bentley (1975), but it contains only the “informed nodes”.

The proposed method of using the dynamic tree construction for the neighborhood search problem in SGS on an unstructured grid is compared to the method of building the optimal tree and using only the “informed” nodes. In our testing workflow we denote the approach of “informed” nodes as “dead leaves”

approach, since we use the tree structure presented in (Friedman et al. 1977), where all the grid blocks correspond to the leaves of the k-d tree. The following testing methodology is proposed: a random grid of 𝑁𝑏= 106 nodes is generated in 3D, on this grid SGS is performed 2500 times with different random paths, the nearest 25 neighbors are searched. Average tree operation times (searching, or searching and insertion) are computed for each iteration of SGS. The average tree operation time for the first 150,000 iterations of SGS is depicted of Figure 6-1, the results for direct search are given for comparison (and as an example of a poor algorithm design).

109 Figure 6-1. Dependence of the average time (ms) of the neighborhood search on a

grid of 106 blocks from the SGS iteration number.

Our tests show that the dynamic construction approach demonstrates significantly better performance than the “dead leaves” approach for the first iterations of SGS. In our test the search time in the dynamically constructed and the

“dead leaves” k-d trees become equivalent around iteration 500,000 of SGS, and further the “dead leaves” solution becomes more efficient. However, the high costs of the first 500,000 iterations of the “dead leaves” approach makes an important contribution to the total time required to perform the 106 iterations of SGS, and in our tests the dynamic tree construction requires in average almost twice less time to perform SGS on the full grid of 106 blocks than the “dead leaves” approach (see Figure 6-2 for average cumulative time).

110 Figure 6-2. Average cumulative time (min) for direct search, “dead leaves” and

dynamic k-d tree construction.

In the tests considered in this thesis the number of blocks in the grid rarely exceeds 𝑁𝑏= 3 × 106 and we use the dynamic tree construction approach in the algorithm. The behavior of the “dead leaves” and dynamically constructed k-d trees in the SGS enables to propose a more optimal hybrid approach – for the big grids (𝑁𝑏 > 106) the search tree should be constructed dynamically and optimized at given periods of time. In the hybrid approach the k-d tree will contain only the pertinent nodes at the given iteration of SGS nodes, and will always be close to an optimally balanced k-d tree.

The cumulative time result on Figure 6-2 is also important since it gives a lower bound for the time of SGS on an unstructured grid of 106 nodes. Only the neighborhood searching time in this procedure takes 4.7 minutes.

111

Dans le document THÈSE DE DOCTORAT (Page 108-112)

Documents relatifs