All Blog Posts

Parallel Neighbour Particle Search - Technical Insights

/images/blog/parallel-neighbour-particle-search-2/title.png

The particle method discretizes fluids or solids into discrete computational units, known as particles. For solids, geometric information is represented by triangular surface elements of varying sizes. Each surface element that interacts with a particle is converted into a ghost wall particle, ensuring that both solid boundaries and fluid regions are represented uniformly in particle form. This unified representation enables numerical computations to focus exclusively on particle–particle interactions.

In the particle method, each particle interacts with its surroundings within a finite influence radius r r . A sphere of radius r r , centered at the particle, defines the region of influence. All particles lying within this sphere are termed neighbouring particles, and any triangular faces within this sphere are identified as neighbouring triangular faces.

Problem Description

A certain number of particles and triangular faces are randomly distributed in three-dimensional space. The interaction between particles and faces has an influence range r r . A sphere with radius r r centered at a given particle is defined, and the triangular faces within this sphere are termed the neighbouring triangular faces of that particle. The task is to identify all neighbouring triangular faces for each particle.

Two-dimensional neighbour particle example
Example: In the 2D case, particle 4 has neighbouring triangular faces with IDs 4, 10, 12, 16, and 17.

Implementation Approach

By drawing a grid in 3D space, each triangular surface in the environment is mapped onto it. One or more grid elements segment each triangular surface, transforming the positional relationship between particles and surfaces into a relationship between grid elements.

Two-dimensional neighbour grid example
As illustrated in the two-dimensional scenario, each triangular face ID and each particle ID correspond to their respective grid IDs.

The grid cell edge length is chosen equal to the particle’s influence radius r r . When determining the neighbouring faces for a particle, it is sufficient to examine faces within the particle’s own grid cell and the 26 surrounding neighbouring cells in 3D. By comparing the actual distances between the particle and these triangular faces to the influence radius r, all valid neighbouring triangular faces can be efficiently identified.

Two-dimensional neighbour grid example

In the two-dimensional scenario, when locating the neighbouring triangular faces of particle 4, the search only needs to consider faces (4, 5, 10, 12, 13, 15, 16, 17) located in grid 9 and its adjacent grids (3, 4, 5, 8, 9, 10, 13, 14, 15). This localized search drastically reduces the computational domain and lowers time complexity.

This algorithm employs a hybrid parallel approach, combining data parallelism and task parallelism. All particle data are distributed across multiple MPI processes, with each process containing full rigid body data. The grid information is traversed in parallel, calculating distances between particles and faces in neighbouring grids.

Because each operation is independent and involves no communication, it’s a prime candidate for parallel processing.

Optimisation Points

A simple mesh search for triangle IDs within neighbouring meshes may yield duplicate IDs. For instance, face ID 10 might appear in grids 4, 9, and 10 when particle 4 searches for neighbours — causing redundant computations. Hence, duplicate filtering must be implemented to ensure each triangular face is considered only once per particle.

Extensions

Solid Information Storage

  • nodes: vertex coordinates of all triangular faces.
  • triangles: vertex connectivity of each face.

Storage of surface information
Storage of Surface Information

Grid Information (zValue)

This algorithm employs the Hilbert curve to map three-dimensional grid coordinates into one-dimensional identifiers. The three-dimensional grid data (x, y, z) is reduced to a one-dimensional representation via the Hilbert curve. Each grid point (x, y, z) is recorded as a long integer (zValue). Morton coding converts the grid coordinates (x, y, z) into a long integer (zValue), and conversely, the grid information (x, y, z) can be retrieved from zValue via Morton coding.

We are ready to help!

  1. Fill out the form

    Provide your contact details and message.

  2. We will contact you

    We'll schedule a free consultation to review your goals.

  3. Tailored Proposal

    You'll receive a detailed proposal with timeline, deliverables, and pricing.

  4. Project Kickoff

    After approval, we give you direct access to our engineers.

我们通常在 24 小时内回复。