77
77
78
78
function SerreGreenNaghdiEquations1D (bathymetry = bathymetry_flat;
79
79
gravity_constant, eta0 = 0.0 )
80
- eta0 == 0.0 ||
81
- @warn " The still-water surface needs to be 0 for the Serre-Green-Naghdi equations"
82
80
SerreGreenNaghdiEquations1D (bathymetry, gravity_constant, eta0)
83
81
end
84
82
83
+ function get_name (equations:: SerreGreenNaghdiEquations1D )
84
+ name = equations |> typeof |> nameof |> string
85
+ bathymetry = equations. bathymetry
86
+ if bathymetry isa BathymetryFlat
87
+ return name
88
+ else # variable bathymetry
89
+ return name * " -" * string (nameof (typeof (bathymetry)))
90
+ end
91
+ end
92
+
85
93
varnames (:: typeof (prim2prim), :: SerreGreenNaghdiEquations1D ) = (" η" , " v" , " D" )
86
94
varnames (:: typeof (prim2cons), :: SerreGreenNaghdiEquations1D ) = (" h" , " hv" , " b" )
87
95
@@ -107,6 +115,46 @@ function initial_condition_convergence_test(x, t, equations::SerreGreenNaghdiEqu
107
115
return SVector (h, v, 0 )
108
116
end
109
117
118
+ """
119
+ initial_condition_dingemans(x, t, equations::SerreGreenNaghdiEquations1D, mesh)
120
+
121
+ The initial condition that uses the dispersion relation of the Euler equations
122
+ to approximate waves generated by a wave maker as it is done by experiments of
123
+ Dingemans. The topography is a trapezoidal. It is assumed that `equations.eta0 = 0.8`.
124
+
125
+ References:
126
+ - Magnus Svärd, Henrik Kalisch (2023)
127
+ A novel energy-bounded Boussinesq model and a well-balanced and stable numerical discretization
128
+ [arXiv: 2302.09924](https://arxiv.org/abs/2302.09924)
129
+ - Maarten W. Dingemans (1994)
130
+ Comparison of computations with Boussinesq-like models and laboratory measurements
131
+ [link](https://repository.tudelft.nl/islandora/object/uuid:c2091d53-f455-48af-a84b-ac86680455e9/datastream/OBJ/download)
132
+ """
133
+ function initial_condition_dingemans (x, t, equations:: SerreGreenNaghdiEquations1D , mesh)
134
+ h0 = 0.8
135
+ A = 0.02
136
+ # omega = 2*pi/(2.02*sqrt(2))
137
+ k = 0.8406220896381442 # precomputed result of find_zero(k -> omega^2 - equations.gravity * k * tanh(k * h0), 1.0) using Roots.jl
138
+ if x < - 34.5 * pi / k || x > - 8.5 * pi / k
139
+ h = 0.0
140
+ else
141
+ h = A * cos (k * x)
142
+ end
143
+ v = sqrt (equations. gravity / k * tanh (k * h0)) * h / h0
144
+ if 11.01 <= x && x < 23.04
145
+ b = 0.6 * (x - 11.01 ) / (23.04 - 11.01 )
146
+ elseif 23.04 <= x && x < 27.04
147
+ b = 0.6
148
+ elseif 27.04 <= x && x < 33.07
149
+ b = 0.6 * (33.07 - x) / (33.07 - 27.04 )
150
+ else
151
+ b = 0.0
152
+ end
153
+ eta = h + h0
154
+ D = equations. eta0 - b
155
+ return SVector (eta, v, D)
156
+ end
157
+
110
158
# flat bathymetry
111
159
function create_cache (mesh,
112
160
equations:: SerreGreenNaghdiEquations1D{BathymetryFlat} ,
@@ -245,15 +293,15 @@ function create_cache(mesh,
245
293
246
294
factorization = cholesky (system_matrix)
247
295
248
- cache = (; h_x, v_x, v_x_upwind, h_hpb_x, b, b_x, hv_x, v2_x,
296
+ cache = (; h, h_x, v_x, v_x_upwind, h_hpb_x, b, b_x, hv_x, v2_x,
249
297
h2_v_vx_x, h_vx_x, p_h, p_0, p_x, tmp,
250
298
M_h_p_h_bx2, M_h3_3, M_h2_bx,
251
299
D, Dmat_minus, factorization)
252
300
else
253
301
if D isa FourierDerivativeOperator
254
302
Dmat = Matrix (D)
255
303
256
- cache = (; h_x, v_x, h_hpb_x, b, b_x, hv_x, v2_x,
304
+ cache = (; h, h_x, v_x, h_hpb_x, b, b_x, hv_x, v2_x,
257
305
h2_v_vx_x, h_vx_x, p_h, p_x, tmp,
258
306
M_h_p_h_bx2, M_h3_3, M_h2_bx,
259
307
D, Dmat)
@@ -285,7 +333,7 @@ function create_cache(mesh,
285
333
286
334
factorization = cholesky (system_matrix)
287
335
288
- cache = (; h_x, v_x, h_hpb_x, b, b_x, hv_x, v2_x,
336
+ cache = (; h, h_x, v_x, h_hpb_x, b, b_x, hv_x, v2_x,
289
337
h2_v_vx_x, h_vx_x, p_h, p_x, tmp,
290
338
M_h_p_h_bx2, M_h3_3, M_h2_bx,
291
339
D, Dmat, factorization)
@@ -531,20 +579,21 @@ function rhs_sgn_central!(dq, q, equations, source_terms, cache,
531
579
532
580
# `q` and `dq` are `ArrayPartition`s. They collect the individual
533
581
# arrays for the water height `h` and the velocity `v`.
534
- h , v = q. x
582
+ eta , v = q. x
535
583
dh, dv, dD = dq. x
536
584
fill! (dD, zero (eltype (dD)))
537
585
538
586
@trixi_timeit timer () " hyperbolic terms" begin
539
587
# Compute all derivatives required below
540
- (; h_x, v_x, h_hpb_x, b, b_x, hv_x, v2_x,
588
+ (; h, h_x, v_x, h_hpb_x, b, b_x, hv_x, v2_x,
541
589
h2_v_vx_x, h_vx_x, p_h, p_x, tmp,
542
590
M_h_p_h_bx2, M_h3_3, M_h2_bx) = cache
543
591
if equations. bathymetry isa BathymetryVariable
544
592
(; ψ) = cache
545
593
end
546
594
547
595
@. b = equations. eta0 - q. x[3 ]
596
+ @. h = eta - b
548
597
mul! (b_x, D, b)
549
598
550
599
mul! (h_x, D, h)
@@ -662,20 +711,21 @@ function rhs_sgn_upwind!(dq, q, equations, source_terms, cache,
662
711
663
712
# `q` and `dq` are `ArrayPartition`s. They collect the individual
664
713
# arrays for the water height `h` and the velocity `v`.
665
- h , v, b = q. x
714
+ eta , v, b = q. x
666
715
dh, dv, db = dq. x
667
716
fill! (db, zero (eltype (db)))
668
717
669
718
@trixi_timeit timer () " hyperbolic terms" begin
670
719
# Compute all derivatives required below
671
- (; h_x, v_x, v_x_upwind, h_hpb_x, b, b_x, hv_x, v2_x,
720
+ (; h, h_x, v_x, v_x_upwind, h_hpb_x, b, b_x, hv_x, v2_x,
672
721
h2_v_vx_x, h_vx_x, p_h, p_0, p_x, tmp,
673
722
M_h_p_h_bx2, M_h3_3, M_h2_bx) = cache
674
723
if equations. bathymetry isa BathymetryVariable
675
724
(; ψ) = cache
676
725
end
677
726
678
727
@. b = equations. eta0 - q. x[3 ]
728
+ @. h = eta - b
679
729
mul! (b_x, D, b)
680
730
681
731
mul! (h_x, D, h)
@@ -856,14 +906,31 @@ function energy_total_modified(q_global,
856
906
N = length (v)
857
907
e = zeros (eltype (q_global), N)
858
908
859
- # 1/2 g h^2 + 1/2 h v^2 + 1/6 h^3 v_x^2
909
+ # 1/2 g h^2 + 1/2 h v^2 + 1/6 h^3 w^2
910
+ # and + 1/8 h (v b_x)^2 for full bathymetry without mild-slope approximation
860
911
if D isa PeriodicUpwindOperators
861
912
mul! (v_x, D. minus, v)
862
913
else
863
914
mul! (v_x, D, v)
864
915
end
865
916
866
- @. e = 1 / 2 * g * h^ 2 + 1 / 2 * h * v^ 2 + 1 / 6 * h^ 3 * v_x^ 2
917
+ if equations. bathymetry isa BathymetryFlat
918
+ b_x = cache. tmp
919
+ fill! (b_x, zero (eltype (b_x)))
920
+ else
921
+ (; b, b_x) = cache
922
+ @. b = equations. eta0 - q_global. x[3 ]
923
+ if D isa PeriodicUpwindOperators
924
+ mul! (b_x, D. central, b)
925
+ else
926
+ mul! (b_x, D, b)
927
+ end
928
+ end
929
+
930
+ @. e = 1 / 2 * g * h^ 2 + 1 / 2 * h * v^ 2 + 1 / 6 * h * (- h * v_x + 1.5 * v * b_x)^ 2
931
+ if equations. bathymetry isa BathymetryVariable
932
+ @. e += 1 / 8 * h * (v * b_x)^ 2
933
+ end
867
934
868
935
return e
869
936
end
0 commit comments