Conversation
There was a problem hiding this comment.
Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit
JuliaFormatter
[JuliaFormatter] reported by reviewdog 🐶
TrixiShallowWater.jl/src/equations/hyperbolic_sainte_marie_1d.jl
Lines 221 to 222 in 470f555
[JuliaFormatter] reported by reviewdog 🐶
TrixiShallowWater.jl/src/equations/hyperbolic_sainte_marie_1d.jl
Lines 226 to 227 in 470f555
[JuliaFormatter] reported by reviewdog 🐶
TrixiShallowWater.jl/src/equations/hyperbolic_sainte_marie_1d.jl
Lines 231 to 234 in 470f555
[JuliaFormatter] reported by reviewdog 🐶
[JuliaFormatter] reported by reviewdog 🐶
[JuliaFormatter] reported by reviewdog 🐶
[JuliaFormatter] reported by reviewdog 🐶
[JuliaFormatter] reported by reviewdog 🐶
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #135 +/- ##
==========================================
+ Coverage 99.28% 99.30% +0.02%
==========================================
Files 96 98 +2
Lines 5146 5290 +144
==========================================
+ Hits 5109 5253 +144
Misses 37 37 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| @doc raw""" | ||
| HyperbolicSainteMarieEquations1D(; bathymetry_type = bathymetry_mild_slope, | ||
| gravity, | ||
| eta0 = 0.0, | ||
| h0, | ||
| alpha = 3.0) | ||
|
|
||
| Hyperbolic approximation of the Sainte-Marie system | ||
| [`SainteMarieEquations1D`](@ref) in one spatial dimension |
There was a problem hiding this comment.
Please fix the docstring so that it matches the code here and not DispersiveShallowWater.jl.
| function HyperbolicSainteMarieEquations1D(; gravity, H0 = zero(gravity), | ||
| b0 = one(gravity), alpha = 3, | ||
| threshold_limiter = nothing) | ||
| T = promote_type(typeof(gravity), typeof(H0), typeof(b0), typeof(alpha)) | ||
| if threshold_limiter === nothing | ||
| threshold_limiter = 500 * eps(T) | ||
| end | ||
| celerity = alpha * sqrt(gravity * b0) |
There was a problem hiding this comment.
I think we should not use b0 to determine the hyperbolization parameter, since Escalante et al. use a reference water height h_0 (and the exact value of the bathymetry b can be changed arbitrarily by moving everything in the vertical direction).
H0 should also not be used since it is a reference for the surface elevation h + b, correct? Maybe we need to introduce another argument, h0, although this can be confusing...
There was a problem hiding this comment.
Would it make sense to use H0 - b0 for the reference water height?
There was a problem hiding this comment.
Yes - but b0 is not used otherwise. Thus, it would be more straightforward to use another parameter name for it, wouldn't it?
There was a problem hiding this comment.
Ah, yes if b0 is not used otherwise I agree it makes more sense to use another parameter name.
There was a problem hiding this comment.
What about using something like h_ref or eta0?
| """ | ||
| flux_conservative_ec(u_ll, u_rr, normal_direction::AbstractVector, equations::HyperbolicSainteMarieEquations1D) | ||
|
|
||
| Total energy conserving and well-balanced two-point flux by | ||
| - Marco Artiano, Hendrik Ranocha (2026) | ||
| On Affordable High-Order Entropy-Conservative/Stable and | ||
| Well-Balanced Methods for Nonconservative Hyperbolic Systems | ||
| [DOI: 10.48550/arXiv.2603.18978](https://arxiv.org/abs/2603.18978) | ||
| """ | ||
| struct flux_conservative_ec{RealT <: Real} |
There was a problem hiding this comment.
Structs should have capital names like FluxConservativeEC. Please also adapt the docstring to describe what the parameters alpha1, alpha2, alpha3 mean, and how the flux can be applied.
It would also be possible to just pick one set of parameters that performs well and stick with it instead of implementing the whole family. I don't have a strong opinion on this. Since performance is not critical right now, it is definitely nice to have the flexibility - but we may recommend some reasonable default value.
There was a problem hiding this comment.
I've fixed the structs' name and adapted the docstrings. We may recommend alpha_1 = 1.0, alpha_2 = 0, alpha_3 = 0, which corresponds to the split form of the shallow water terms and strong form of the remaining terms. Eventually also alpha_1 = 1.0, alpha_2 = 1.0, alpha_3 = 1.0 works (as informative example), which results in a split form for all the terms.
| # Convert conservative variables to entropy | ||
| # Note, only the first two are the entropy variables, the third entry still | ||
| # just carries the bottom topography values for convenience | ||
| @inline function Trixi.cons2entropy(u, equations::HyperbolicSainteMarieEquations1D) | ||
| h, h_v, h_w, h_p, b = u | ||
|
|
||
| v = h_v / h | ||
| w = h_w / h | ||
| p = h_p / h | ||
|
|
||
| w1 = equations.gravity * (h + b) - 0.5f0 * (v^2 + w^2 + p^2 / equations.celerity^2) | ||
| w2 = v | ||
| w3 = w | ||
| w4 = p / equations.celerity^2 | ||
| return SVector(w1, w2, w3, w4, zero(eltype(u))) | ||
| end |
There was a problem hiding this comment.
The comment about the bottom topography and the code do not match.
Co-authored-by: Hendrik Ranocha <ranocha@users.noreply.github.com>
…work/TrixiShallowWater.jl into ma/hyperbolized_sainte_marie
The entropy conserving and well-balanced scheme is derived in https://arxiv.org/abs/2603.18978.