Repository navigation
Cylinder IBs: honor the axis set by length_y/length_z (fixes 3D start-up hang) #2060
Description
Summary
Cylinder immersed boundaries (patch_ib%geometry = 10) are assumed to lie along x in three places, so a cylinder set along y or z (with length_y or length_z) either hangs the simulation at start-up or silently loses its body.
- Start-up hang.
s_get_ib_boundusessqrt(radius**2 + length_x**2). For a y/z cylinder,length_xis the unset default −1e6, so the bound is 10⁶ m. The automaticib_neighborhood_radius(1536 ib neighborhood radius automatic size checking #1736) turns that into ~10⁹ exchange rounds, ands_get_neighbor_boundsloops inMPI_Sendrecvindefinitely: all ranks were found there in stack traces of a hung GPU job, and the CPU MPI build hangs the same way. Nothing is printed, since Cray Fortran buffers stdout to files. Even for x-aligned cylinders the bound used the full length where half is meant. - No IB cells. Both marker loops call
f_is_inside_cylinder(xyz_local(2), xyz_local(3), xyz_local(1), radius, length_x), so a y/z cylinder marks no cells (since 1454-projection-optimization #1549). - Wrong levelset axis. The cylinder levelset picks its axis by testing
length /= 0, which always selects x because the unset default is −1e6, not 0.
Change
f_cylinder_axis(1/2/3, whichever length is set, default z) andf_is_inside_ib_cylinderinm_ib_patches; both marker loops and the levelset use them.s_get_ib_bound:sqrt(radius**2 + (0.5*max(length_x, length_y, length_z))**2).- New regression test: the existing 3D cylinder IBM case with the axis along z (8 variants, following the existing cylinder tests).
x-aligned cylinders are unchanged: no existing golden moved.
Verification
- On master, the new z-aligned case aborts at start-up with "an immersed boundary marked no cell anywhere" (on multi-rank GPU runs of larger cases it hung instead, as described above). With this PR its golden generates, and it differs from the same case without the IB in ~1,700–2,300 of 15,625 cells per field, so the body is really there.
./mfc.sh test --only Cylinder: 8 passed;--only IBM: 69 passed (CPU).- Found while setting up 3D runs of three spanwise-periodic burning rods; with this fix they start and run on 16 MI300A nodes.
Not addressed here: a finite (non-periodic) rod develops a NaN near its end edges after ~20 steps on a coarse grid. That is present with x-aligned rods on master too, so it is a separate issue.
The bug was reproduced, located in a debugger and verified as described above.
A fix for this is already written. The pull request was closed only to reduce the number of simultaneously open PRs from this author, not because the work was rejected or found incorrect.
- Closed PR: Cylinder IBs: honor the axis set by length_y/length_z (fixes 3D start-up hang) #1962
- Branch:
fix-cylinder-axison thesbryngelsonfork, at965400b5a9 - Reopening needs no force-push and no rebase:
gh pr reopen 1962 -R MFlowCode/MFC
Tracked with the pr-to-do label so the whole set is discoverable together.
Filed with Claude Code.
Activity