Skip to content

Make pressure clipping in BoundaryModelDummyParticles optional#1143

Open
efaulhaber wants to merge 3 commits intotrixi-framework:mainfrom
efaulhaber:boundary-pressure-clipping
Open

Make pressure clipping in BoundaryModelDummyParticles optional#1143
efaulhaber wants to merge 3 commits intotrixi-framework:mainfrom
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.19%. Comparing base (da45b6f) to head (79d51de).

Files with missing lines Patch % Lines
.../schemes/boundary/wall_boundary/dummy_particles.jl 86.66% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1143      +/-   ##
==========================================
- Coverage   89.19%   89.19%   -0.01%     
==========================================
  Files         128      128              
  Lines        9919     9927       +8     
==========================================
+ Hits         8847     8854       +7     
- Misses       1072     1073       +1     
Flag Coverage Δ
total 89.19% <86.66%> (-0.01%) ⬇️
unit 67.64% <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

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants