-
Notifications
You must be signed in to change notification settings - Fork 112
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
Adding quasi 1d shallow water equations #1619
Adding quasi 1d shallow water equations #1619
Conversation
Review checklistThis 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 ❤️ by the Trixi.jl community. |
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #1619 +/- ##
==========================================
+ Coverage 92.94% 96.11% +3.17%
==========================================
Files 416 418 +2
Lines 34070 34223 +153
==========================================
+ Hits 31666 32892 +1226
+ Misses 2404 1331 -1073
Flags with carried forward coverage won't be shown. Click here to find out more.
☔ View full report in Codecov by Sentry. |
The test failures appear to be from #1617. |
Co-authored-by: Hendrik Ranocha <[email protected]>
@KrisshChawla when you're ready, please re-request a review from us |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall this looks quite good so far! I left a few suggestions for clean-up. My main two questions are
- Is entropy conservation and/or stability ever tested? Such that you verify that the newly implemented fluxes are working properly. For the most strenuous test it would good to test against initial conditions with discontinuities in all variables including
b
anda
. Even though a discontinuous channel width might be "unphysical" or meaningless, this is only an academic test to make sure everything is working. - Was well-balancedness ever tested to make sure the fluxes are implemented correctly? This is related to one of my suggestions that noted a function to compute the well-balancedness error is missing. This set of equations would need a specialized version of this function because one needs to divide off the channel width from the water height in the conservative variables. Similar to the question above, a well-balancedness test with a discontinuous bottom topography is always more strenuous to make sure the implementation is behaving as expected.
using Trixi | ||
|
||
############################################################################### | ||
# Semidiscretization of the shallow water equations |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# Semidiscretization of the shallow water equations | |
# Semidiscretization of the quasi 1d shallow water equations | |
# See Chan et al. https://doi.org/10.48550/arXiv.2307.12089 for details |
Maybe adding a link to the paper here is overkill but I was not sure how well-known these equations are.
@@ -0,0 +1,59 @@ | |||
using OrdinaryDiffEq |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The name of this elixir does not follow the normal convention. Typically, the convergence test elixirs would be something like elixir_shallow_water_quasi_1d_source_terms.jl
. Also, we prefer to avoid capital letters in the files names.
test/test_tree_1d_shallowwater.jl
Outdated
@trixi_testset "elixir_shallow_water_quasi_1D_manufactured.jl" begin | ||
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_shallow_water_quasi_1D_manufactured.jl"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the filename of the elixir changes, this will need updated.
e = (a_h_v^2) / (2 * a * a_h) + 0.5 * equations.gravity * (a_h^2 / a) + | ||
equations.gravity * a_h * b | ||
return e | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is well-balancedness ever computed? As far as I can tell there is a missing function to compute this error, like the following (modulo a bunch of the comments therein. I was lazy and just copied over and slightly modified the code from the shallow_water_1d.jl
file.
# Calculate the error for the "lake-at-rest" test case where H = h+b should
# be a constant value over time. Note, assumes there is a single reference
# water height `H0` with which to compare.
#
# TODO: TrixiShallowWater: where should `threshold_limiter` live? May need
# to modify or have different versions of the `lake_at_rest_error` function
@inline function lake_at_rest_error(u, equations::ShallowWaterEquationsQuasi1D)
_, _, b, _ = u
h = waterheight(u, equations)
# For well-balancedness testing with possible wet/dry regions the reference
# water height `H0` accounts for the possibility that the bottom topography
# can emerge out of the water as well as for the threshold offset to avoid
# division by a "hard" zero water heights as well.
H0_wet_dry = max(equations.H0, b + equations.threshold_limiter)
return abs(H0_wet_dry - (h + b))
end
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can check this - I originally removed this from this PR to make it shorter, but it'd be great to demonstrate this property.
Co-authored-by: Andrew Winters <[email protected]>
The initial condition in the elixir is intended to test a discontinuous channel width 'a(x)' and bottom topography 'b(x)' on a periodic mesh.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
@andrewwinters5000, for the entropy conservation check, do we usually add that as a test or do we just comment with the result we get from running an EC elixir?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you change the name to examples/tree_1d_dgsem/elixir_shallowwater_quasi_1d_well_balanced.jl
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I will rename it.
examples/tree_1d_dgsem/elixir_shallowwater_quasi1d_well_balanced.jl
Outdated
Show resolved
Hide resolved
…ed.jl Co-authored-by: Jesse Chan <[email protected]>
We typically report results of a local run. Right now, we do not have an automated way of checking EC in CI. |
A slightly less convenient method could be to write out entropy conservation information in the analysis callback to a file, and then read that file back during test verification. It would probably require some additional coding but nothing extremely difficult. |
The entropy conservation test results in an error of '∑∂S/∂U ⋅ Uₜ : 1.58068003e-14' when using the entropy conservative flux ‘(flux_chan_etal, flux_nonconservative_chan_etal)’ for surface and volume fluxes along with the adjusted non-periodic initial condition for total water height ‘H = 3 + 0.5 * x[1]’ in the well balancedness test case. |
I should clarify that this is using the setup from the well-balanced test case, which involved spatially varying and discontinuous |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's wait for @andrewwinters5000 to take a look but it looks good to me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good from my end of things. The entropy conservation test results look good and the new well-balancedness test is a nice addition.
Added an equation type and entropy conservative fluxes for the quasi 1d shallow water equations based on https://doi.org/10.48550/arXiv.2307.12089. We also added a manufactured solution elixir which also serves as a CI test.