Skip to content

Inline half-step in neighbor loop#156

Open
AhmedSalih3d wants to merge 1 commit intocodex/refactor-to-avoid-if-statementfrom
codex/finalize-particle-interaction-algorithm
Open

Inline half-step in neighbor loop#156
AhmedSalih3d wants to merge 1 commit intocodex/refactor-to-avoid-if-statementfrom
codex/finalize-particle-interaction-algorithm

Conversation

@AhmedSalih3d
Copy link
Owner

Motivation

  • Integrate the half-step state update into the neighbor interaction pass so per-particle half-step updates (acceleration, position, velocity, density) are computed inline with neighbor interactions and avoid a separate HalfTimeStep pass.
  • Ensure gravity is applied consistently during the half-step accumulation and make the neighbor loop responsible for producing Positionₙ⁺, Velocityₙ⁺, and ρₙ⁺ for the next staged pass.

Description

  • Added NeighborLoopPerParticleHalfStep! variants that mirror existing NeighborLoopPerParticle! signatures (handling NoKernel/KernelOutput and Shifting modes) which accumulate dρdt, Acceleration, kernel/shift outputs where applicable, compute AccelerationMax, apply gravity with ConstructGravitySVector, and write Positionₙ⁺, Velocityₙ⁺, and ρₙ⁺ inline using the provided dt₂.
  • Replaced the first neighbor-loop + separate HalfTimeStep sequence in the main simulation loop with a single call to NeighborLoopPerParticleHalfStep! and updated the @timeit labels to reflect the consolidated step ordering.
  • Left the original NeighborLoopPerParticle! implementations intact for the second neighbor pass and preserved dispatch patterns for compatibility across kernel/shifting/MDBC modes.

Testing

  • Commands executed during development: ls, rg -n "ComputeInteractionsPerParticleNoKernel" src, several sed -n inspections of src/TimeStepping.jl and src/SPHCellList.jl, git status --short, git add src/SPHCellList.jl, and git commit -m "Inline half-step in neighbor loop".
  • No automated test suite or runtests was executed as part of this change, so no automated tests were run or reported here.

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