Skip to content

Fix ShallowWaterExnerEquations1D for negative / zero velocities#101

Merged
andrewwinters5000 merged 6 commits intotrixi-framework:mainfrom
patrickersing:fix_exner_negative_vel
May 15, 2025
Merged

Fix ShallowWaterExnerEquations1D for negative / zero velocities#101
andrewwinters5000 merged 6 commits intotrixi-framework:mainfrom
patrickersing:fix_exner_negative_vel

Conversation

@patrickersing
Copy link
Copy Markdown
Member

This PR fixes some bugs that occur when ShallowWaterExnerEquations1D are applied for test cases with negative or zero velocities. Theses errors were not covered by the current test setup, so I also added a new elixir elixir_shallowwater_exner_dam_break_symmetric to cover these cases.

There were two bugs present:

  • To avoid division by zero when computing the effective sediment height h_s we introduce a condition v<eps() to introduce a special treatment for zero velocities. This was changed to abs(v) < eps() to not apply this for negative velocities.
  • The computation of h_s_avg in the dissipation_roe was changed to avoid division by zero velocities.

In addition to that I also updated the representation of some constants to be compatible with single precision and introduced a type conversion to the constructor of the sediment models.

@patrickersing patrickersing added the bug Something isn't working label May 13, 2025
@patrickersing patrickersing marked this pull request as ready for review May 13, 2025 18:16
@codecov
Copy link
Copy Markdown

codecov bot commented May 13, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.19%. Comparing base (75de71d) to head (c1bf10e).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #101   +/-   ##
=======================================
  Coverage   99.19%   99.19%           
=======================================
  Files          72       73    +1     
  Lines        3449     3459   +10     
=======================================
+ Hits         3421     3431   +10     
  Misses         28       28           

☔ 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
Member

@andrewwinters5000 andrewwinters5000 left a comment

Choose a reason for hiding this comment

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

LGTM!

@andrewwinters5000 andrewwinters5000 merged commit 891417c into trixi-framework:main May 15, 2025
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants