Make continuity_equation! and density_diffusion! work on Ref values#1130
Make continuity_equation! and density_diffusion! work on Ref values#1130efaulhaber wants to merge 8 commits intotrixi-framework:mainfrom
continuity_equation! and density_diffusion! work on Ref values#1130Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1130 +/- ##
===========================================
- Coverage 89.00% 67.17% -21.83%
===========================================
Files 128 128
Lines 9838 9846 +8
===========================================
- Hits 8756 6614 -2142
- Misses 1082 3232 +2150
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:
|
There was a problem hiding this comment.
Pull request overview
This PR refactors density-rate updates so continuity_equation! and density_diffusion! can accumulate into a Ref (e.g., drho_particle) rather than writing directly into dv, enabling a later optimization to write dv once per particle (as described in #1116 / #1131).
Changes:
- Update fluid WCSPH and EDAC RHS interaction loops to pass
v_a/v_band accumulatedrho_particle::Refviacontinuity_equation!, then write viawrite_drho_particle!. - Refactor
density_diffusion!to accumulate intodrho_particle::Refand adjust call sites accordingly. - Adjust shifting-technique helpers to operate on/return a transformed
v_diffvalue.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/schemes/structure/structure.jl | Switch structure–fluid continuity update to accumulate into Ref and add a write_drho_particle! writeback path. |
| src/schemes/fluid/weakly_compressible_sph/rhs.jl | Accumulate density-rate in Ref and write once via write_drho_particle!. |
| src/schemes/fluid/weakly_compressible_sph/density_diffusion.jl | Make density diffusion accumulate into Ref instead of writing to dv. |
| src/schemes/fluid/shifting_techniques.jl | Update shifting continuity helpers to accept/return v_diff directly. |
| src/schemes/fluid/fluid.jl | Refactor continuity_equation! to write into Ref and introduce write_drho_particle! dispatch. |
| src/schemes/fluid/entropically_damped_sph/rhs.jl | Use Ref accumulation for continuity equation and defer writeback. |
| src/schemes/boundary/wall_boundary/rhs.jl | Use Ref accumulation for boundary dummy-particle continuity update. |
| src/schemes/boundary/open_boundary/rhs.jl | Update density diffusion call to use Ref accumulation (continuity term remains direct). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This PR makes
continuity_equation!anddensity_diffusion!work on Ref values instead of directly writing todv. Together with #1116, it makes it possible to accumulatedrho_particleover all neighbors and only once write it todv.It is part of #1131.