Skip to content

Remove AccelerationMax buffer and compute max acceleration from Acceleration vector#161

Open
AhmedSalih3d wants to merge 3 commits intocodex/refactor-to-avoid-if-statementfrom
codex/find-max-acceleration-without-vector
Open

Remove AccelerationMax buffer and compute max acceleration from Acceleration vector#161
AhmedSalih3d wants to merge 3 commits intocodex/refactor-to-avoid-if-statementfrom
codex/find-max-acceleration-without-vector

Conversation

@AhmedSalih3d
Copy link
Owner

Motivation

  • Eliminate the separate per-particle AccelerationMax buffer to reduce memory allocations and duplication.
  • Compute the timestep criterion from the existing per-particle acceleration vectors instead of maintaining a separate magnitude array.
  • Keep neighbor-loop kernels unchanged in behavior while removing the extra write of norms during interaction accumulation.

Description

  • Changed UpdateTimeStep signature to accept the Acceleration vector and replaced maximum(AccelerationMax) with a manual single-pass loop that computes norm(Acceleration[i]) using @inbounds @simd to avoid extra allocations.
  • Removed the AccelerationMax parameter from all NeighborLoopPerParticle! method signatures and deleted the per-particle assignment AccelerationMax[i] = norm(acc_acc) inside those loops.
  • Updated call sites in src/SPHCellList.jl to stop allocating/using AccelerationMax and to pass Acceleration into UpdateTimeStep.
  • Removed the temporary allocation of AccelerationMax in the simulation initialization path so the timestep is derived directly from the Acceleration buffer.

Testing

  • No automated tests were run as part of this change.

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