Skip to content

Specialize particle boundary types#176

Open
AhmedSalih3d wants to merge 1 commit into
BeforeLidDrivenCavityExamplefrom
codex/specialize-particle-container-types
Open

Specialize particle boundary types#176
AhmedSalih3d wants to merge 1 commit into
BeforeLidDrivenCavityExamplefrom
codex/specialize-particle-container-types

Conversation

@AhmedSalih3d

Copy link
Copy Markdown
Owner

Motivation

  • Improve compiler specialization at the simulation boundary by making the particle StructArray shape concrete so the particle field tuple is visible to methods called from RunSimulation and neighbor loops.
  • Reduce runtime dynamic field lookup and potential JET reports by threading a concrete particle container alias through hot entry points and kernels.

Description

  • Add SimParticleStructArray alias in src/PreProcess.jl as const SimParticleStructArray{ParticleTuple, FieldArrays, IndexType} = StructArray{ParticleTuple, 1, FieldArrays, IndexType} and export it.
  • Thread the SimParticleStructArray{ParticleTuple, FieldArrays, IndexType} type into signatures for RunSimulation, SimulationLoop, all NeighborLoopPerParticle! overloads, and ComputeInteractionsPerParticle! variants in src/SPHCellList.jl so the particle tuple and field arrays are concrete to the compiler.
  • Specialize SetupVTKOutput in src/ProduceHDFVTK.jl to accept a typed StructArray (StructArray{ParticleTuple, 1, FieldArrays, IndexType}) and add the necessary StructArrays import.
  • Re-export SimParticleStructArray from the package entrypoint in src/SPHExample.jl so downstream code can use the alias in signatures.

Testing

  • Verified package loads with julia --project=. -e 'using SPHExample; println("loaded")', which succeeded.
  • Ran the test suite with julia --project=. -e 'using Pkg; Pkg.test()', which errored: time stepping test raised MethodError for a Δt call (no matching 5-argument method); this failure appears unrelated to the particle-container specialization.

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