Skip to content

Half-step wrappers, neighbor-list robustness, UpdateΔx fallback, and make StillWedge example portable#153

Open
AhmedSalih3d wants to merge 2 commits intocodex/refactor-to-avoid-if-statementfrom
codex/remove-support-data-code-structures-2ilb0a
Open

Half-step wrappers, neighbor-list robustness, UpdateΔx fallback, and make StillWedge example portable#153
AhmedSalih3d wants to merge 2 commits intocodex/refactor-to-avoid-if-statementfrom
codex/remove-support-data-code-structures-2ilb0a

Conversation

@AhmedSalih3d
Copy link
Owner

Motivation

  • Reduce per-step allocations and enable neighbor/kernel code to operate on on-demand half-step views to support symplectic-like stepping semantics.
  • Preserve existing clamping and density-update semantics while allowing time-stepping to use half-step values without method errors.
  • Prevent neighbor-list failures from too-small ParticleRanges and accept lazy/wrapper-backed position-like inputs for UpdateΔx!.
  • Make the StillWedgeMDBC example runnable outside a Windows environment and remove an undefined profiling macro.

Description

  • Added HalfStepPosition, HalfStepVelocity, and HalfStepDensity wrapper types with IndexStyle/axes/size/getindex implementations in src/SPHCellList.jl to compute half-step values on demand and passed those wrappers into neighbor calls.
  • Moved support buffers (e.g. dρdtI, AccelerationMax, gradient buffers) into the main SimulationLoop and removed per-step temporaries, wired PressureHalfStep! and a new DensityEpsi! overload into the time-stepping sequence in src/SPHCellList.jl and src/SimulationEquations.jl.
  • Made UpdateNeighbors! defensive by resizing ParticleRanges to length(Particles) + 2, setting the sentinel entry to length(Particles) + 1, and forcing a rebuild when SimMetaData.IndexCounter == 0 in src/SPHNeighborList.jl.
  • Imported LinearAlgebra.dot and added a generic UpdateΔx! fallback that accepts wrapper-backed position-like inputs and computes squared norms using dot in src/SPHNeighborList.jl.
  • Exported PressureHalfStep! and added the accompanying half-step pressure/density helper functions in src/SimulationEquations.jl so callers can invoke them.
  • Made example changes in example/StillWedgeMDBC.jl to remove @profview, use a local OutputDirectory = joinpath(pwd(), "output", "StillWedge2D_MDBC"), and create it with mkpath so the script runs on non-Windows systems.

Testing

  • Ran julia --project=. -e 'include("example/StillWedgeMDBC.jl")', which initially failed due to @profview being undefined, and then succeeded to start after removing the macro and making the output directory portable.
  • Precompilation completed successfully and the example produced simulation startup output (particle counts, kernel and metadata), but the full simulation is long-running and was interrupted during manual testing.
  • No automated unit tests were executed for these changes.

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