Skip to content

IBM: 1-rank and 2-rank runs differ when two bodies touch at a rank seam (corrected_gps flags do not cross the seam) #2388

Open

Description

@sbryngelson

Problem

Two bodies in contact across a rank seam give a different fluid force on 1 rank and on 2 ranks. A seam test (two circles head-on across the x = 10 seam, friction 0.1, D/ib_forces.dat) is bitwise identical through step 16 stage 0, then the y force and torque differ by about 1e-6 at step 17, the x force by 7e-4 at step 20 and 5.6e-2 on body 2 at step 46.

Cause (found by a per-stage cell dump on the CPU, verified by reading, not yet by a fix)

  • The collision force is identical across rank counts (up to the sign of the pair order), and listing the bodies in the opposite order is bitwise identical on 1 rank, so lookup order is not the cause.
  • At t = 0.64 stage 2, four interior body cells at the point where the bodies touch the seam, (39,59), (39,60), (40,59), (40,60), differ: in the 2-rank run they hold one body's velocity (about 0.285 in x), in the 1-rank run the average of the two bodies (0.163 and -0.162). Markers and all other cells are identical.
  • These cells are set by the "ghost point whose image point is buried in a neighboring IB" fallback in src/simulation/m_ibm.fpp (about lines 1024-1090). It averages the neighbouring valid ghost points, found through corrected_gps%sf(jj,kk,ll) == 1. That flag is set only for a rank's own interior ghost points (about line 2416, rebuilt about line 4137) and never in halo cells, so on 2 ranks the average cannot see the other body's ghost cells across the seam. All 216 flag mismatches in the dump are halo cells.
  • The averaging loop also reads q values that may be one stage stale in the halo.

Proposed fix

Fill corrected_gps (and whatever the average reads) in the halo cells when the ghost points are rebuilt, with an integer halo exchange like ib_markers. The work is O(surface), so it scales to many bodies. Test: the seam case on 1, 2 and 4 ranks (x seam, y seam, periodic edge) must agree to about 1e-12; 2-rank IBM goldens generated with this defect will change toward the 1-rank answer.

Status

A fix is being prepared (draft PR to follow). The earlier 2.6e-4 residual with friction off and the 0.355 force difference in a larger study are probably the same effect.

AI-assisted (Claude Code).

Activity

  1. added
    bugSomething isn't working or doesn't seem right
    on Nov 22, 2026
  2. sbryngelson commented on Nov 22, 2026

    @sbryngelson
    MemberAuthor

    Related pull requests: #2354 (friction regularisation, merged), #2371 and #2384 (num_procs device update, merged), #2201 (collision detection, merged). The fix PR will be linked here when opened.

    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

    bugSomething isn't working or doesn't seem right

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions