Skip to content

Euler-Lagrange collisions: pair detection is O(n^2) per rank per stage; use a cell (linked-cell) list #2394

Open

Description

@sbryngelson

Problem

In the EL collision work (#2171), s_detect_el_collisions tests all particle pairs on a rank every Runge-Kutta stage, and its lookup table can reach about 192 MB. That is fine for hundreds of particles per rank and expensive at 10^4 or more (10^8 pair tests per stage).

Proposal

Bin particles into cells at least as large as the contact distance (a counting sort on the GPU: histogram with atomics plus a prefix sum), then test only the particle's own and neighbouring cells (3^d): O(n) at bounded density, O(1) per particle. A Verlet skin list rebuilds only when the largest displacement exceeds half the skin. When particles are smaller than a grid cell, the existing mesh cell index can serve as the bin key. Immersed-body detection on master is already linear in the number of ghost points (it scans the marker field within 2 cells), so this only concerns point particles.

Needs

The expected particle count per GPU, to decide when this matters.

AI-assisted (Claude Code).

Activity

  1. sbryngelson commented on Nov 22, 2026

    @sbryngelson
    MemberAuthor

    Related pull requests: #2171 (EL collisions, open) and #2201 (IBM collision detection, merged).

    AI-assisted (Claude Code).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions