Skip to content

Make pressure clipping in BoundaryModelDummyParticles optional#1143

Merged
efaulhaber merged 14 commits intotrixi-framework:devfrom
efaulhaber:boundary-pressure-clipping
Apr 28, 2026
Merged

Make pressure clipping in BoundaryModelDummyParticles optional#1143
efaulhaber merged 14 commits intotrixi-framework:devfrom
efaulhaber:boundary-pressure-clipping

Conversation

@efaulhaber
Copy link
Copy Markdown
Member

@efaulhaber efaulhaber commented Apr 14, 2026

Pressure clipping is not a correct formulation, it is just a workaround to avoid sticking artifacts.
Away from free surfaces it leads to artificially increased boundary pressures that cause larger gaps between fluid and boundary in areas of low pressure, against which the particle shifting technique is fighting.

This PR adds an option to disable clipping, which should be enabled for closed systems.

@efaulhaber efaulhaber self-assigned this Apr 14, 2026
@efaulhaber efaulhaber added the enhancement New feature or request label Apr 14, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 14, 2026

Codecov Report

❌ Patch coverage is 86.66667% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.03%. Comparing base (b0144b4) to head (a6c8cb0).
⚠️ Report is 1 commits behind head on dev.

Files with missing lines Patch % Lines
.../schemes/boundary/wall_boundary/dummy_particles.jl 86.66% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #1143      +/-   ##
==========================================
- Coverage   89.03%   89.03%   -0.01%     
==========================================
  Files         128      128              
  Lines       10032    10040       +8     
==========================================
+ Hits         8932     8939       +7     
- Misses       1100     1101       +1     
Flag Coverage Δ
total 89.03% <86.66%> (-0.01%) ⬇️
unit 68.10% <86.66%> (+0.03%) ⬆️

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.

@efaulhaber efaulhaber marked this pull request as ready for review April 17, 2026 11:51
@efaulhaber efaulhaber requested a review from Copilot April 17, 2026 11:51
Copy link
Copy Markdown
Contributor

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 makes negative pressure clipping in BoundaryModelDummyParticles configurable so it can be disabled for closed-system simulations where clipping would be physically incorrect and can introduce artifacts.

Changes:

  • Added a clip_negative_pressure keyword (default true) to BoundaryModelDummyParticles and threaded it through the model type for compile-time branching.
  • Updated boundary pressure computation to conditionally clip negative pressures (both for state-equation-based pressure and Adami extrapolation).
  • Added tests covering clipping on/off behavior and ensuring the setting survives Adapt.adapt.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/schemes/boundary/wall_boundary/dummy_particles.jl Adds optional negative-pressure clipping to BoundaryModelDummyParticles with a static (type-parameter) flag used in pressure update paths.
test/schemes/boundary/dummy_particles/dummy_particles.jl Adds unit tests validating clipping behavior for multiple density calculators and through Adapt.adapt.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@efaulhaber efaulhaber requested review from LasNikas and svchb April 17, 2026 11:56
@svchb
Copy link
Copy Markdown
Collaborator

svchb commented Apr 17, 2026

What is supposed to happen when clipping in the state equation is activated and deactivated here?

@efaulhaber
Copy link
Copy Markdown
Member Author

When clipping in the state equation is activated, then pressure is clipped everywhere and it cannot become negative anyway, except perhaps with Adami when the boundary is accelerated away from the fluid.

@svchb
Copy link
Copy Markdown
Collaborator

svchb commented Apr 17, 2026

But shouldn't this be an error than or warning?

@efaulhaber
Copy link
Copy Markdown
Member Author

But shouldn't this be an error than or warning?

Why? Everything is working as expected.

@svchb
Copy link
Copy Markdown
Collaborator

svchb commented Apr 19, 2026

Because the inconsistency might be confusing.

@efaulhaber
Copy link
Copy Markdown
Member Author

I don't see an inconsistency. Enable pressure clipping for the boundary model to clip boundary pressure. Enable pressure clipping of the state equation to enable global pressure clipping.

@svchb
Copy link
Copy Markdown
Collaborator

svchb commented Apr 19, 2026

Ok than just adjust the docstring also for state equation pressure clipping.

Comment thread src/schemes/boundary/wall_boundary/dummy_particles.jl Outdated
@efaulhaber efaulhaber added the breaking changes This change will break the public API and requires a new major release label Apr 21, 2026
@efaulhaber efaulhaber added this to the 0.5 milestone Apr 21, 2026
@efaulhaber efaulhaber changed the base branch from main to dev April 21, 2026 14:52
@efaulhaber efaulhaber force-pushed the boundary-pressure-clipping branch 2 times, most recently from 39f91ec to 2d60da5 Compare April 21, 2026 14:53
@efaulhaber efaulhaber force-pushed the boundary-pressure-clipping branch from 2d60da5 to f96828b Compare April 21, 2026 14:54
@efaulhaber efaulhaber mentioned this pull request Apr 23, 2026
7 tasks
@efaulhaber efaulhaber requested a review from LasNikas April 23, 2026 09:21
Copy link
Copy Markdown
Collaborator

@svchb svchb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Add a similar note to state equation
  • add a test for the mixed stateequation/boundary clipping

Comment thread src/schemes/boundary/wall_boundary/dummy_particles.jl
@efaulhaber
Copy link
Copy Markdown
Member Author

/run-gpu-tests

@efaulhaber
Copy link
Copy Markdown
Member Author

/run-gpu-tests

@efaulhaber efaulhaber merged commit af4764b into trixi-framework:dev Apr 28, 2026
18 of 19 checks passed
@efaulhaber efaulhaber deleted the boundary-pressure-clipping branch April 28, 2026 09:54
efaulhaber referenced this pull request Apr 29, 2026
Merge dev to main for 0.5 release
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking changes This change will break the public API and requires a new major release enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants