Skip to content

Conversation

@cwittens
Copy link
Member

No description provided.

@cwittens
Copy link
Member Author

Here are come convergence test results:

test_results = convergence_test(joinpath(examples_dir(), "hyperbolic_serre_green_naghdi_1d", "hyperbolic_serre_green_naghdi_manufactured_reflecting.jl"), [32, 64, 128, 256, 512]);

# using bathymetry_mild_slope:

# for accuracy_order = 2
####################################################################################################
l2
η                        v                        D                        w                        H
N    error     EOC       N    error     EOC       N    error     EOC       N    error     EOC       N    error     EOC
32   1.96e-02  -         32   6.18e-03  -         32   0.00e+00  -         32   1.11e+00  -         32   1.97e-02  -
64   6.60e-03  1.57      64   1.47e-03  2.07      64   0.00e+00  NaN       64   1.12e+00  -0.01     64   6.66e-03  1.57
128  2.27e-03  1.54      128  3.59e-04  2.03      128  0.00e+00  NaN       128  1.13e+00  -0.00     128  2.30e-03  1.53
256  7.93e-04  1.52      256  8.89e-05  2.02      256  0.00e+00  NaN       256  1.13e+00  -0.00     256  8.04e-04  1.52
512  2.79e-04  1.51      512  2.21e-05  2.01      512  0.00e+00  NaN       512  1.13e+00  -0.00     512  2.83e-04  1.51

mean           1.53      mean           2.03      mean           NaN       mean           -0.00     mean           1.53
----------------------------------------------------------------------------------------------------
linf
η                        v                        D                        w                        H
N    error     EOC       N    error     EOC       N    error     EOC       N    error     EOC       N    error     EOC
32   1.28e-01  -         32   9.91e-03  -         32   0.00e+00  -         32   1.72e+00  -         32   1.30e-01  -
64   6.46e-02  0.98      64   2.35e-03  2.08      64   0.00e+00  NaN       64   1.73e+00  -0.01     64   6.57e-02  0.99
128  3.25e-02  0.99      128  5.72e-04  2.04      128  0.00e+00  NaN       128  1.74e+00  -0.00     128  3.30e-02  0.99
256  1.63e-02  1.00      256  1.41e-04  2.02      256  0.00e+00  NaN       256  1.74e+00  -0.00     256  1.65e-02  1.00
512  8.15e-03  1.00      512  4.08e-05  1.79      512  0.00e+00  NaN       512  1.74e+00  -0.00     512  8.28e-03  1.00

mean           0.99      mean           1.98      mean           NaN       mean           -0.00     mean           0.99
----------------------------------------------------------------------------------------------------

# for accuracy_order = 4
####################################################################################################
l2
η                        v                        D                        w                        H
N    error     EOC       N    error     EOC       N    error     EOC       N    error     EOC       N    error     EOC
32   1.22e-02  -         32   5.39e-03  -         32   0.00e+00  -         32   1.14e+00  -         32   1.23e-02  -
64   2.53e-03  2.26      64   7.51e-04  2.84      64   0.00e+00  NaN       64   1.13e+00  0.01      64   2.57e-03  2.26
128  4.80e-04  2.40      128  9.78e-05  2.94      128  0.00e+00  NaN       128  1.13e+00  0.00      128  4.87e-04  2.40
256  8.77e-05  2.45      256  1.25e-05  2.97      256  0.00e+00  NaN       256  1.13e+00  0.00      256  8.89e-05  2.45
512  1.58e-05  2.47      512  2.09e-06  2.58      512  0.00e+00  NaN       512  1.13e+00  0.00      512  1.60e-05  2.47

mean           2.40      mean           2.83      mean           NaN       mean           0.00      mean           2.40
----------------------------------------------------------------------------------------------------
linf
η                        v                        D                        w                        H
N    error     EOC       N    error     EOC       N    error     EOC       N    error     EOC       N    error     EOC
32   9.73e-02  -         32   8.40e-03  -         32   0.00e+00  -         32   1.74e+00  -         32   9.91e-02  -
64   2.93e-02  1.73      64   1.21e-03  2.80      64   0.00e+00  NaN       64   1.74e+00  0.00      64   2.98e-02  1.73
128  7.94e-03  1.88      128  1.60e-04  2.91      128  0.00e+00  NaN       128  1.74e+00  0.00      128  8.06e-03  1.89
256  2.06e-03  1.95      256  2.77e-05  2.54      256  0.00e+00  NaN       256  1.74e+00  -0.00     256  2.09e-03  1.95
512  5.28e-04  1.96      512  3.78e-05  -0.45     512  0.00e+00  NaN       512  1.74e+00  0.00      512  5.32e-04  1.97

mean           1.88      mean           1.95      mean           NaN       mean           0.00      mean           1.89
----------------------------------------------------------------------------------------------------

@cwittens
Copy link
Member Author

This is how I calculated the manufactured solution:

# 1d manufactured solution for hyperbolic Serre-Green-Naghdi equations

using Symbolics

@variables x t
Dt = Differential(t)
Dx = Differential(x)

@variables g pi λ

h = 1 + (2 * t) * (cos(pi*(x)) + x + 2)
vx = (-t * x) * sin(pi*(x))
b = (2 * x) # or b = 0
eta = h
w = -h * Dx(vx) + 3//2 * vx * Dx(b)

PI = λ // 3 * (eta / h) * (1 - eta / h)
# taken from https://arxiv.org/pdf/2408.02665 eq. (89)
eq1 = Dt(h) + Dx(h * vx)
eq2 = Dt(vx) + (g * h * Dx(h) + h * vx * Dx(vx) + Dx(h * PI) + (g * h + 3 // 2 * h / eta * PI) * Dx(b)) / h
eq3 = Dt(w) + vx * Dx(w) - λ * (1 - eta / h) / h
eq4 = Dt(eta) + Dx(eta) * vx + 3//2 * Dx(b) * vx - w

s1 = simplify(expand_derivatives(eq1))
s2 = simplify(expand_derivatives(eq2))
s3 = 0
s4 = simplify(expand_derivatives(eq3))
s5 = simplify(expand_derivatives(eq4))

println("s1 = $s1\n")
println("s2 = $s2\n")
println("s3 = zero(s1)\n")
println("s4 = $s4\n")
println("s5 = $s5\n")

@github-actions
Copy link
Contributor

github-actions bot commented Jul 26, 2025

Benchmark Results (Julia v1.10)

Time benchmarks
main 78a807e... main / 78a807e...
bbm_1d/bbm_1d_basic.jl - rhs!: 13.7 ± 0.27 μs 13.8 ± 0.28 μs 0.995 ± 0.028
bbm_1d/bbm_1d_fourier.jl - rhs!: 0.529 ± 0.0093 ms 0.534 ± 0.0093 ms 0.992 ± 0.025
bbm_bbm_1d/bbm_bbm_1d_basic_reflecting.jl - rhs!: 0.0805 ± 0.00043 ms 0.0805 ± 0.0004 ms 1 ± 0.0073
bbm_bbm_1d/bbm_bbm_1d_dg.jl - rhs!: 0.0344 ± 0.0005 ms 0.0366 ± 0.00044 ms 0.94 ± 0.018
bbm_bbm_1d/bbm_bbm_1d_relaxation.jl - rhs!: 26.9 ± 1.8 μs 27.3 ± 0.41 μs 0.986 ± 0.067
bbm_bbm_1d/bbm_bbm_1d_upwind_relaxation.jl - rhs!: 0.0485 ± 0.0009 ms 0.0485 ± 0.00054 ms 1 ± 0.022
hyperbolic_serre_green_naghdi_1d/hyperbolic_serre_green_naghdi_dingemans.jl - rhs!: 4.19 ± 0.03 μs 4.31 ± 0.04 μs 0.972 ± 0.011
kdv_1d/kdv_1d_basic.jl - rhs!: 1.45 ± 0.013 μs 1.42 ± 0.02 μs 1.02 ± 0.017
kdv_1d/kdv_1d_implicit.jl - rhs!: 1.39 ± 0.02 μs 1.43 ± 0.02 μs 0.973 ± 0.019
serre_green_naghdi_1d/serre_green_naghdi_well_balanced.jl - rhs!: 0.192 ± 0.0058 ms 0.2 ± 0.0081 ms 0.96 ± 0.048
svaerd_kalisch_1d/svaerd_kalisch_1d_dingemans_relaxation.jl - rhs!: 0.142 ± 0.0025 ms 0.149 ± 0.0045 ms 0.952 ± 0.033
time_to_load 1.97 ± 0.0053 s 1.99 ± 0.0034 s 0.993 ± 0.0031
Memory benchmarks
main 78a807e... main / 78a807e...
bbm_1d/bbm_1d_basic.jl - rhs!: 1 allocs: 4.12 kB 1 allocs: 4.12 kB 1
bbm_1d/bbm_1d_fourier.jl - rhs!: 1 allocs: 4.12 kB 1 allocs: 4.12 kB 1
bbm_bbm_1d/bbm_bbm_1d_basic_reflecting.jl - rhs!: 5 allocs: 1.17 kB 5 allocs: 1.17 kB 1
bbm_bbm_1d/bbm_bbm_1d_dg.jl - rhs!: 10 allocs: 8.62 kB 10 allocs: 8.62 kB 1
bbm_bbm_1d/bbm_bbm_1d_relaxation.jl - rhs!: 2 allocs: 8.25 kB 2 allocs: 8.25 kB 1
bbm_bbm_1d/bbm_bbm_1d_upwind_relaxation.jl - rhs!: 2 allocs: 8.25 kB 2 allocs: 8.25 kB 1
hyperbolic_serre_green_naghdi_1d/hyperbolic_serre_green_naghdi_dingemans.jl - rhs!: 0 allocs: 0 B 0 allocs: 0 B
kdv_1d/kdv_1d_basic.jl - rhs!: 0 allocs: 0 B 0 allocs: 0 B
kdv_1d/kdv_1d_implicit.jl - rhs!: 0 allocs: 0 B 0 allocs: 0 B
serre_green_naghdi_1d/serre_green_naghdi_well_balanced.jl - rhs!: 0.075 k allocs: 0.66 MB 0.075 k allocs: 0.66 MB 1
svaerd_kalisch_1d/svaerd_kalisch_1d_dingemans_relaxation.jl - rhs!: 0.042 k allocs: 0.315 MB 0.042 k allocs: 0.315 MB 1
time_to_load 0.153 k allocs: 14.5 kB 0.153 k allocs: 14.5 kB 1

@JoshuaLampert JoshuaLampert added the enhancement New feature or request label Jul 26, 2025
@coveralls
Copy link
Collaborator

coveralls commented Jul 26, 2025

Pull Request Test Coverage Report for Build 16544586009

Details

  • 29 of 29 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.02%) to 98.314%

Totals Coverage Status
Change from base Build 16506099434: 0.02%
Covered Lines: 2274
Relevant Lines: 2313

💛 - Coveralls

Copy link
Member

@JoshuaLampert JoshuaLampert left a comment

Choose a reason for hiding this comment

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

Thanks! This looks good to me. Just for clarification: Do you have a formal proof of entropy conservation for this semidiscretization? It only uses a SAT for $$h$$, but no further treatment of the other variables is needed, right?

@cwittens
Copy link
Member Author

Thanks! This looks good to me. Just for clarification: Do you have a formal proof of entropy conservation for this semidiscretization?

Yes. I dont have a TeXed version of the proof yet, but I did calculate it and energy is conserved for both flat and variable bottom topography.

It only uses a SAT for h , but no further treatment of the other variables is needed, right?

In the conservative form you also have additional terms for $u$, $w$ and $\eta$, but when going to primitive variables they all cancle out and only the term for $h$ is left.

@JoshuaLampert
Copy link
Member

Thanks! This looks good to me. Just for clarification: Do you have a formal proof of entropy conservation for this semidiscretization?

Yes. I dont have a TeXed version of the proof yet, but I did calculate it and energy is conserved for both flat and variable bottom topography.

It only uses a SAT for h , but no further treatment of the other variables is needed, right?

In the conservative form you also have additional terms for u , w and η , but when going to primitive variables they all cancle out and only the term for h is left.

Ah, that's interesting. Thanks for the explanation!

@JoshuaLampert JoshuaLampert merged commit 2137700 into NumericalMathematics:main Jul 27, 2025
10 checks passed
@cwittens cwittens deleted the hyperbolic_sgn_reflecting branch July 28, 2025 10:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants