Skip to content

Make continuity_equation! and density_diffusion! work on Ref values#1130

Open
efaulhaber wants to merge 8 commits intotrixi-framework:mainfrom
efaulhaber:continuity-equation-ref
Open

Make continuity_equation! and density_diffusion! work on Ref values#1130
efaulhaber wants to merge 8 commits intotrixi-framework:mainfrom
efaulhaber:continuity-equation-ref

Conversation

@efaulhaber
Copy link
Copy Markdown
Member

@efaulhaber efaulhaber commented Apr 2, 2026

This PR makes continuity_equation! and density_diffusion! work on Ref values instead of directly writing to dv. Together with #1116, it makes it possible to accumulate drho_particle over all neighbors and only once write it to dv.
It is part of #1131.

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 7, 2026

Codecov Report

❌ Patch coverage is 75.36232% with 17 lines in your changes missing coverage. Please review.
✅ Project coverage is 67.17%. Comparing base (419d5b9) to head (6bc3034).

Files with missing lines Patch % Lines
src/schemes/fluid/shifting_techniques.jl 18.18% 9 Missing ⚠️
src/schemes/boundary/open_boundary/rhs.jl 0.00% 6 Missing ⚠️
...fluid/weakly_compressible_sph/density_diffusion.jl 50.00% 2 Missing ⚠️

❗ There is a different number of reports uploaded between BASE (419d5b9) and HEAD (6bc3034). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (419d5b9) HEAD (6bc3034)
total 1 0
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     
Flag Coverage Δ
total ?
unit 67.17% <75.36%> (+0.05%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown

Copilot AI left a 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 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_b and accumulate drho_particle::Ref via continuity_equation!, then write via write_drho_particle!.
  • Refactor density_diffusion! to accumulate into drho_particle::Ref and adjust call sites accordingly.
  • Adjust shifting-technique helpers to operate on/return a transformed v_diff value.

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.

@efaulhaber efaulhaber marked this pull request as ready for review April 7, 2026 16:37
@efaulhaber efaulhaber requested a review from svchb April 7, 2026 16:37
@efaulhaber efaulhaber requested review from LasNikas and svchb April 14, 2026 09:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants