Skip to content

Fix neighbor rebuild storage and add guard/test#192

Open
AhmedSalih3d wants to merge 1 commit into
BeforeLidDrivenCavityExamplefrom
codex/fix-neighbor-list-rebuild-bug
Open

Fix neighbor rebuild storage and add guard/test#192
AhmedSalih3d wants to merge 1 commit into
BeforeLidDrivenCavityExamplefrom
codex/fix-neighbor-list-rebuild-bug

Conversation

@AhmedSalih3d

Copy link
Copy Markdown
Owner

Motivation

  • Repeated neighbor-list rebuilds could corrupt or index past UniqueCells when every particle occupies its own cell, causing failures during simulations and tests.

Description

  • Allocate one extra slot for UniqueCells in src/SPHCellList.jl so there is always a sentinel/dummy cell available for the rebuild path.
  • Add a defensive size check in UpdateNeighbors! in src/SPHNeighborList.jl to throw a clear ArgumentError if UniqueCells is undersized instead of silently corrupting state.
  • Add a regression test in test/runtests.jl that repeatedly rebuilds the neighbor list with all particles in unique cells to exercise the sentinel-aware path.
  • Update existing tests to use the current Δt API (scalar max-acceleration form) and to pass the velocity buffer to FullTimeStep so the test suite matches the current APIs.

Testing

  • Ran the full test-suite with julia --project=. -e 'using Pkg; Pkg.test()' and the test run completed successfully with all tests passing.
  • Exercised the specific neighbor-rebuild scenario with a focused one-liner test (julia --project=. -e 'using Test, SPHExample, StructArrays, StaticArrays; @testset "neighbor rebuild with all unique cells" begin ... end') and it passed.
  • The regression test added to test/runtests.jl was executed as part of Pkg.test() and validated the fix.

Codex Task

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant