Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ShallowWaterEquationsWetDry1D #10

Merged
merged 24 commits into from
Jan 19, 2024

Conversation

patrickersing
Copy link
Contributor

@patrickersing patrickersing commented Dec 18, 2023

This PR adds the new equations ShallowWaterEquationsWetDry1D together with some tests.

The PR introduces only a first version of the equations that is supposed to work without any changes to Trixi.jl. For this reason some features that require changes in Trixi.jl are not moved yet. The main idea is to have a first working PR to test and discuss how to do the separation from Trixi.jl.

Here are some important points and changes to discuss:

  • I think the main consideration is how we want to interface with Trixi.jl. Mainly how we import/export functions that are used in both Packages. Here from what I can tell we have different options.
    Currently I import only Trixi.jl and then qualify the function names with Trixi.func. We could also import these functions explicitly, but I like that in the current way you can directly see, which functions come from Trixi.jl.

  • I currently have to make a copy of test_trixi.jl to get access to the testing macros. Is this okay or should we make some changes to export this from Trixi.jl?

  • I have added a new test to check for namespace conflicts between Trixi.jl and TrixiShallowWater.jl in runtests.jl. Can you think of additional testing we should include to ensure compatibility?

  • For the new equation I need to introduce a lot of wrapper functions to existing Trixi.jl functions as the basic model remains in Trixi.jl, e.g.
    @inline function Trixi.flux(u, orientation::Integer, equations::ShallowWaterEquationsWetDry1D) return Trixi.flux(u, orientation, Trixi.ShallowWaterEquations1D(equations.gravity, equations.H0, eps(), eps())) end
    Let me know if you can think of a better way to do this.

Besides that I think it would be good to check the new CI workflow that I modified.

Copy link

codecov bot commented Dec 18, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (4ca97ca) 100.00% compared to head (8184d68) 100.00%.

Additional details and impacted files
@@            Coverage Diff            @@
##              main       #10   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            1         4    +3     
  Lines            3        85   +82     
=========================================
+ Hits             3        85   +82     

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

@patrickersing
Copy link
Contributor Author

@JoshuaLampert thanks for investigating and finding the problem! This was very helpful.
So the reason why this appeared is that we only ran the tests once with coverage. To fix this I have adapted the ci.yml to the way it works in Trixi.jl so that we have separate test runs with and without coverage.

@JoshuaLampert
Copy link
Member

Yes, that makes sense.

Copy link
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.

That you for tackling this @patrickersing ! Overall I like this structure and since we have using Trixi in src/TrixiShallowWater.jl it forces us to be very specific when certain routines are reused and called from the "parent" Trixi package, e.g. the wrapper needed for cons2prim. I am open if there is a more Julian way to do this, but for new users I like how explicit and obvious it is as to what functions come from this package and what functions are called from the original package.

.github/workflows/ci.yml Show resolved Hide resolved
examples/tree_1d_dgsem/elixir_shallowwater_ec.jl Outdated Show resolved Hide resolved
test/test_unit.jl Outdated Show resolved Hide resolved
src/equations/shallow_water_wet_dry_1d.jl Show resolved Hide resolved
src/equations/shallow_water_wet_dry_1d.jl Show resolved Hide resolved
src/equations/shallow_water_wet_dry_1d.jl Show resolved Hide resolved
src/equations/shallow_water_wet_dry_1d.jl Outdated Show resolved Hide resolved
Project.toml Show resolved Hide resolved
src/TrixiShallowWater.jl Show resolved Hide resolved
@patrickersing patrickersing mentioned this pull request Jan 10, 2024
Copy link
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.

Everything basically looks good from my side @patrickersing . Just one last comment needs updated and/or removed.

src/TrixiShallowWater.jl Outdated Show resolved Hide resolved
Copy link
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!

Copy link
Member

@ranocha ranocha left a comment

Choose a reason for hiding this comment

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

LGTM

test/test_tree_1d_shallowwater_wet_dry.jl Outdated Show resolved Hide resolved
test/test_tree_1d_shallowwater_wet_dry.jl Outdated Show resolved Hide resolved
@andrewwinters5000 andrewwinters5000 merged commit 823f19d into trixi-framework:main Jan 19, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants