Skip to content

Add WCSPH shifting corrections (density/velocity gradient accumulation and application)#172

Open
AhmedSalih3d wants to merge 4 commits intocodex/refactor-to-avoid-if-statementfrom
codex/add-options-for-shifting-constants
Open

Add WCSPH shifting corrections (density/velocity gradient accumulation and application)#172
AhmedSalih3d wants to merge 4 commits intocodex/refactor-to-avoid-if-statementfrom
codex/add-options-for-shifting-constants

Conversation

@AhmedSalih3d
Copy link
Owner

Motivation

  • Shifting currently only accumulates particle-position correction vectors without applying the WCSPH-style density/velocity corrections, which can leave post-shift density/velocity inconsistent.
  • The free-surface shifting logic needs to remain dimension-aware and provide a guardable free-surface mode so corrections only apply when intended.
  • Support buffers and neighbor-loop accumulation must be extended so the full-time update can apply consistent density and velocity corrections after shifting.

Description

  • Extend support allocations in src/PreProcess.jl to return new gradient buffers ∇ρᵢ and ∇uᵢ for simulations with shifting.
  • Update neighbor-loop APIs and call sites in src/SPHCellList.jl to accept the additional gradient buffers and to accumulate per-pair contributions to density_grad_acc and velocity_grad_acc in both kernel and no-kernel interaction paths.
  • Modify FullTimeStep in src/TimeStepping.jl to accept the new buffers and apply WCSPH-style corrections by updating Density[i] += dot(δxᵢ, ∇ρᵢ[i]) and Velocity[i] += (∇uᵢ[i] * δxᵢ) after computing the shift δxᵢ, while preserving the free-surface guarded shifting behaviour and adding dimension-aware FreeSurfaceThreshold helpers.
  • Add FreeSurfaceMode/InternalFlow/FreeSurfaceCorrection types in src/SimulationMetaDataConfiguration.jl and re-export the symbols from src/SPHExample.jl, and update the isolated-particle test in test/runtests.jl to unpack the expanded allocation tuple.

Testing

  • Unit tests were updated (the isolated-particle test now accepts ∇ρ/∇u from AllocateSupportDataStructures), but no automated test suite was executed as part of this change.
  • Commands used for local inspection during the change included repository searches and file previews such as rg -n "∇ρᵢ" src and nl -ba src/TimeStepping.jl | sed -n '120,220p' to verify call-site and function signature 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