Make PST work for different smoothing length factors#834
Merged
svchb merged 7 commits intotrixi-framework:mainfrom Jul 23, 2025
Merged
Make PST work for different smoothing length factors#834svchb merged 7 commits intotrixi-framework:mainfrom
svchb merged 7 commits intotrixi-framework:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the particle shifting callback to correctly handle a range of smoothing length factors by introducing a dedicated dx variable and updating the shift magnitude calculation.
- Extracted
particle_spacing(system, 1)intodxand reused it for kernel evaluation. - Replaced the original linear-in-h formula with a quadratic-in-h and linear-in-dx scaling for
delta_r_, adding comments to explain the change.
Comments suppressed due to low confidence (2)
src/callbacks/particle_shifting.jl:108
- [nitpick] Referencing an internal PR link in comments can be brittle; consider citing the original paper (Sun et al. 2017, p.29) or documenting the rationale in the external changelog instead.
# See https://github.com/trixi-framework/TrixiParticles.jl/pull/834.
src/callbacks/particle_shifting.jl:109
- The new shifting formula significantly alters particle behavior; consider adding unit or integration tests that verify correct behavior across small and large smoothing length factors.
delta_r_ = -dt * v_max * (2 * h)^2 / (2 * dx) * (1 + R * (kernel / Wdx)^n) *
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #834 +/- ##
==========================================
- Coverage 70.46% 70.45% -0.02%
==========================================
Files 106 106
Lines 6894 6895 +1
==========================================
Hits 4858 4858
- Misses 2036 2037 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
LasNikas
approved these changes
Jul 1, 2025
svchb
requested changes
Jul 2, 2025
Member
Author
LasNikas
approved these changes
Jul 23, 2025
Collaborator
|
/run-gpu-tests |
svchb
approved these changes
Jul 23, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


On main, PST doesn't work for small smoothing length factors. The following examples are all with the Wendland C2 kernel.
This PR makes it work for a wide range of time steps, smoothing length factors, and resolutions: