-
Notifications
You must be signed in to change notification settings - Fork 15
Make PST work for different smoothing length factors #834
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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)
intodx
and 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.43% 70.42% -0.02%
==========================================
Files 106 106
Lines 6867 6868 +1
==========================================
Hits 4837 4837
- Misses 2030 2031 +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:
|
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: