trixi-framework / Trixi.jl

Trixi.jl: Adaptive high-order numerical simulations of conservation laws in Julia
https://trixi-framework.github.io/Trixi.jl
MIT License
505 stars 98 forks source link

Fix computation of `max_abs_speeds` for the SWE #1898

Closed patrickersing closed 3 months ago

patrickersing commented 3 months ago

The wave speed in max_abs_speeds for the SWE computes the wave celerity as c = equations.gravity * sqrt(h) instead of c = sqrt(equations.gravity * h). This PR fixes the computation and adjusts the test values accordingly. In some elixirs the cfl had to be set back to cfl = 1.0, because they became unstable when using the new wave speed.

github-actions[bot] commented 3 months ago

Review checklist

This checklist is meant to assist creators of PRs (to let them know what reviewers will typically look for) and reviewers (to guide them in a structured review process). Items do not need to be checked explicitly for a PR to be eligible for merging.

Purpose and scope

Code quality

Documentation

Testing

Performance

Verification

Created with :heart: by the Trixi.jl community.

codecov[bot] commented 3 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 96.30%. Comparing base (0f60ebc) to head (1a89afe).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1898 +/- ## ======================================= Coverage 96.30% 96.30% ======================================= Files 448 448 Lines 36006 36006 ======================================= Hits 34672 34672 Misses 1334 1334 ``` | [Flag](https://app.codecov.io/gh/trixi-framework/Trixi.jl/pull/1898/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=trixi-framework) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/trixi-framework/Trixi.jl/pull/1898/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=trixi-framework) | `96.30% <100.00%> (ø)` | | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=trixi-framework#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

patrickersing commented 3 months ago

The modified wave speed affects the downstream tests for Trixi2Vtk.jl using elixir_shallowwater_ec.jl on UnstructuredMesh2D. I think we just need to update the respective reference files in Trixi2Vtk_reference_files.

image

andrewwinters5000 commented 3 months ago

The modified wave speed affects the downstream tests for Trixi2Vtk.jl using elixir_shallowwater_ec.jl on UnstructuredMesh2D. I think we just need to update the respective reference files in Trixi2Vtk_reference_files.

Yes, that is indeed the case. We will need a new reference file.

DanielDoehring commented 3 months ago

Good spot!

I am a bit embarrassed that I did not spot this when adding more refined wave speed estimates, as it is for the 1D case only 10 lines below :O

https://github.com/trixi-framework/Trixi.jl/blame/main/src/equations/shallow_water_1d.jl

andrewwinters5000 commented 3 months ago

I am even more embarrassed because I introduced this bug in my initial implementation of the 2D shallow water equations. I have no idea how/why I wrote the function this way. The 1D bug just propagated my initial mistake.

ranocha commented 3 months ago

The modified wave speed affects the downstream tests for Trixi2Vtk.jl using elixir_shallowwater_ec.jl on UnstructuredMesh2D. I think we just need to update the respective reference files in Trixi2Vtk_reference_files.

Yes, that is indeed the case. We will need a new reference file.

Could you please prepare a PR for that? I would like to see green CI before merging this PR.

patrickersing commented 3 months ago

Do we also need to create new releases for the changes to take effect across packages?

ranocha commented 3 months ago

Yes. I just started the registration process for Trixi2Vtk.jl. It should be released in half an hour or so. Please update this PR later so that the new version is used in CI. Afterwards, we can merge this PR and release a new version of Trixi.jl so that CI for Trixi2Vtk.jl works again.

andrewwinters5000 commented 3 months ago

Yes. I just started the registration process for Trixi2Vtk.jl.

The new version merged, so I merged main into this PR to trigger the CI again.