diff --git a/benchmark/benchmarks.jl b/benchmark/benchmarks.jl index 46a5ef90b..f43fe2bec 100644 --- a/benchmark/benchmarks.jl +++ b/benchmark/benchmarks.jl @@ -22,7 +22,7 @@ for elixir in elixirs benchname = joinpath(basename(dirname(elixir)), basename(elixir)) * " - rhs!:" println("Running $benchname...") redirect_stdout(devnull) do - trixi_include(@__MODULE__, elixir, tspan = (0.0, 1e-10)) + trixi_include(@__MODULE__, elixir, tspan = (0.0, 1e-11)) end SUITE[benchname] = @benchmarkable DispersiveShallowWater.rhs!($(similar(sol.u[end])), $(copy(sol.u[end])), diff --git a/docs/src/basic_example.md b/docs/src/basic_example.md index af1154825..87515b7c7 100644 --- a/docs/src/basic_example.md +++ b/docs/src/basic_example.md @@ -72,11 +72,11 @@ Lastly, we define the physical domain as the interval from -130 to 20 and we cho ## Define numerical solver -In the next step, we build a [`Semidiscretization`](@ref) that bundles all ingredients for the spatial discretization of the model. Especially, we need to define a [`Solver`](@ref). +In the next step, we build a [`Semidiscretization`](@ref) that bundles all ingredients for the spatial discretization of the model. Especially, we need to define a [`Solver`](@ref). The simplest way to define a solver when working with [`boundary_condition_periodic`](@ref) is to call the constructor by providing the mesh and a desired order of accuracy. -In the following example, we use an accuracy order of 4. The default constructor simply creates periodic first-, second-, and third-derivative central finite difference summation-by-parts (SBP) operators of the provided order of accuracy. +In the following example, we use an accuracy order of 4. The default constructor simply creates periodic first-, second-, and third-derivative central finite difference summation-by-parts (SBP) operators of the provided order of accuracy. How to use other summation-by-parts operators, is described in the section on [how to customize the solver](@ref customize_solver). Note that for non-periodic boundary conditions, the solver also needs to be created with non-periodic operators, see, e.g. [examples/bbm\_bbm\_1d/bbm\_bbm\_1d\_basic\_reflecting.jl](https://github.com/NumericalMathematics/DispersiveShallowWater.jl/blob/main/examples/bbm_bbm_1d/bbm_bbm_1d_basic_reflecting.jl). @@ -127,11 +127,10 @@ nothing # hide ![shoaling solution](shoaling_solution.png) -By default, this will plot the bathymetry, but not the initial (analytical) solution. +By default, this will plot the bathymetry, but not the initial (analytical) solution. You can adjust this by passing the boolean values `plot_bathymetry` (if `true`, always plot bathymetry in the first subplot) and `plot_initial`. Note that `plot_initial = true` will evaluate and plot the initial condition function at the same time `t` as the numerical solution being displayed (the final time by default). This means if your initial condition function represents an analytical solution, setting `plot_initial = true` will plot the analytical solution at that specific time for comparison. - Plotting an animation over time can, e.g., be done by the following command, which uses `step` to plot the solution at a specific time step. Here `conversion = waterheight_total` makes it so that we only look at the waterheight ``\eta`` and not also the velocity ``v``. More on tutorials for plotting can be found in the chapter [Plotting Simulation Results](@ref plotting). ```@example overview @@ -150,7 +149,6 @@ It is also possible to plot the solution variables at a fixed spatial point over More examples sorted by the simulated equations can be found in the [examples/](https://github.com/NumericalMathematics/DispersiveShallowWater.jl/tree/main/examples) subdirectory. - ## [Plain program](@id overview-plain-program) Here follows a version of the program without any comments. diff --git a/docs/src/callbacks.md b/docs/src/callbacks.md index 3c6522a0c..3070fa647 100644 --- a/docs/src/callbacks.md +++ b/docs/src/callbacks.md @@ -1,7 +1,7 @@ # Callbacks Callbacks provide additional functionality during simulations, such as monitoring solution properties, analyzing errors, or ensuring conservation of physical quantities. -[DispersiveShallowWater.jl](https://github.com/NumericalMathematics/DispersiveShallowWater.jl implements three main callback types that can be used individually or in combination to enhance simulation analysis and performance monitoring. +[DispersiveShallowWater.jl](https://github.com/NumericalMathematics/DispersiveShallowWater.jl) implements three main callback types that can be used individually or in combination to enhance simulation analysis and performance monitoring. When using multiple callbacks simultaneously, combine them using a `CallbackSet`: @@ -9,6 +9,7 @@ When using multiple callbacks simultaneously, combine them using a `CallbackSet` callbacks = CallbackSet(analysis_callback, summary_callback) sol = solve(ode, Tsit5(), callback = callbacks) ``` + More information on the usage of callbacks within the SciML framework can be found [in the documentation](https://docs.sciml.ai/DiffEqDocs/stable/features/callback_functions/). ## Summary Callback @@ -28,7 +29,7 @@ sol = solve(ode, Tsit5(), callback = summary_callback) At the end of the simulation, the callback will display output similar to: -``` +```julia ─────────────────────────────────────────────────────────────────────────────────────────── DispersiveSWE Time Allocations ─────────────────────── ──────────────────────── @@ -46,7 +47,6 @@ analyze solution 3 13.2ms 3.0% 4.39ms 147KiB 0. ─────────────────────────────────────────────────────────────────────────────────────────── ``` - ## Analysis Callback The [`AnalysisCallback`](@ref) monitors solution quality and physical properties during the simulation. It computes error norms and tracks conservation of important physical quantities at specified time intervals. @@ -189,4 +189,4 @@ For additional information on relaxation, how it works, and why and when it is u [^RanochaSayyariDalcinParsaniKetcheson2020]: Ranocha, Sayyari, Dalcin, Parsani, Ketcheson (2020): Relaxation Runge–Kutta Methods: Fully-Discrete Explicit Entropy-Stable Schemes for the Compressible Euler and Navier–Stokes Equations. - [DOI: 10.1137/19M1263480](https://doi.org/10.1137/19M1263480) \ No newline at end of file + [DOI: 10.1137/19M1263480](https://doi.org/10.1137/19M1263480) diff --git a/docs/src/dingemans.md b/docs/src/dingemans.md index 0fbd22f30..d0ee0c810 100644 --- a/docs/src/dingemans.md +++ b/docs/src/dingemans.md @@ -10,7 +10,7 @@ The bathymetry profile consists of: - A flat section from the wave maker to x = 11.01 - A linearly increasing slope from x = 11.01 to x = 23.04 (maximum height of 0.6) -- A flat plateau from x = 23.04 to x = 27.04 +- A flat plateau from x = 23.04 to x = 27.04 - A linearly decreasing slope from x = 27.04 to x = 33.07 - A flat section beyond x = 33.07 @@ -33,17 +33,17 @@ Next, we set up the different equation systems we want to compare: bbmbbm = BBMBBMEquations1D(bathymetry_type = bathymetry_variable, gravity = 9.81, eta0 = 0.0) -# Svärd-Kalisch equations with specific parameter set -sk = SvaerdKalischEquations1D(gravity = 9.81, eta0 = 0.8, alpha = 0.0, - beta = 0.27946992481203003, gamma = 0.0521077694235589) +# Svärd-Kalisch equations with specific parameter set (optimized for small wave numbers) +sk = SvaerdKalischEquations1D(gravity = 9.81, eta0 = 0.8, alpha = 0.0004040404040404049, + beta = 0.49292929292929294, gamma = 0.15707070707070708) -# Serre-Green-Naghdi equations with variable bathymetry +# Serre-Green-Naghdi equations with variable bathymetry sgn = SerreGreenNaghdiEquations1D(bathymetry_type = bathymetry_variable, - gravity = 9.81) + gravity = 9.81, eta0 = 0.8) # Hyperbolic approximation of Serre-Green-Naghdi equations hysgn = HyperbolicSerreGreenNaghdiEquations1D(bathymetry_type = bathymetry_mild_slope, - lambda = 100.0, gravity = 9.81) + lambda = 100.0, gravity = 9.81, eta0 = 0.8) # for actual simulations a higher lambda (~500) is recommended # it is chosen so low to be able to see the difference between it # and the SGN equation. @@ -134,8 +134,7 @@ y_limits = (-0.03, 0.87) # Model configurations: (semidiscretization, solution, label, conversion_function, linestyle) models = [ (semi_bbmbbm, sol_bbmbbm, "BBM-BBM", shifted_waterheight, :solid), - # Svärd-Kalisch has a phase shift which need to be adjusted for in the initial condition - # (semi_sk, sol_sk, "Svärd-Kalisch", waterheight_total, :dashdotdot), + (semi_sk, sol_sk, "Svärd-Kalisch", waterheight_total, :dashdotdot), (semi_sgn, sol_sgn, "Serre-Green-Naghdi", waterheight_total, :dot), (semi_hysgn, sol_hysgn, "Hyperbolic Serre-Green-Naghdi", waterheight_total, :dashdot) ] @@ -164,7 +163,7 @@ for time_val in times push!(snapshot_plots, p) end -# Create legend plot +# Create legend plot legend_plot = plot(legend=:top, framestyle=:none, legendfontsize=11) for (i, (_, _, label, _, linestyle)) in enumerate(models) @@ -190,7 +189,6 @@ nothing # hide The results show how different dispersive wave models capture the wave evolution over the trapezoidal bathymetry. - ## [Plain program](@id overview-plain-program-dingemans) Here follows a version of the program without any comments. @@ -202,17 +200,17 @@ using DispersiveShallowWater, OrdinaryDiffEqTsit5, Plots bbmbbm = BBMBBMEquations1D(bathymetry_type = bathymetry_variable, gravity = 9.81, eta0 = 0.0) -# Svärd-Kalisch equations with specific parameter set -sk = SvaerdKalischEquations1D(gravity = 9.81, eta0 = 0.8, alpha = 0.0, - beta = 0.27946992481203003, gamma = 0.0521077694235589) +# Svärd-Kalisch equations with specific parameter set (optimized for small wave numbers) +sk = SvaerdKalischEquations1D(gravity = 9.81, eta0 = 0.8, alpha = 0.0004040404040404049, + beta = 0.49292929292929294, gamma = 0.15707070707070708) -# Serre-Green-Naghdi equations with variable bathymetry +# Serre-Green-Naghdi equations with variable bathymetry sgn = SerreGreenNaghdiEquations1D(bathymetry_type = bathymetry_variable, - gravity = 9.81) + gravity = 9.81, eta0 = 0.8) # Hyperbolic approximation of Serre-Green-Naghdi equations hysgn = HyperbolicSerreGreenNaghdiEquations1D(bathymetry_type = bathymetry_mild_slope, - lambda = 100.0, gravity = 9.81) + lambda = 100.0, gravity = 9.81, eta0 = 0.8) # for actual simulations a higher lambda (~500) is recommended # it is chosen so low to be able to see the difference between it # and the SGN equation. @@ -262,8 +260,7 @@ y_limits = (-0.03, 0.87) # Model configurations: (semidiscretization, solution, label, conversion_function, linestyle) models = [ (semi_bbmbbm, sol_bbmbbm, "BBM-BBM", shifted_waterheight, :solid), - # Svärd-Kalisch has a phase shift which need to be adjusted for in the initial condition - # (semi_sk, sol_sk, "Svärd-Kalisch", waterheight_total, :dashdotdot), + (semi_sk, sol_sk, "Svärd-Kalisch", waterheight_total, :dashdotdot), (semi_sgn, sol_sgn, "Serre-Green-Naghdi", waterheight_total, :dot), (semi_hysgn, sol_hysgn, "Hyperbolic Serre-Green-Naghdi", waterheight_total, :dashdot) ] @@ -292,7 +289,7 @@ for time_val in times push!(snapshot_plots, p) end -# Create legend plot +# Create legend plot legend_plot = plot(legend=:top, framestyle=:none, legendfontsize=11) for (i, (_, _, label, _, linestyle)) in enumerate(models) @@ -321,4 +318,4 @@ plot(all_plots..., [^Dingemans1997]: Dingemans (1997): Water Wave Propagation Over Uneven Bottoms (In 2 Parts). - [DOI: 10.1142/1241](https://doi.org/10.1142/1241) \ No newline at end of file + [DOI: 10.1142/1241](https://doi.org/10.1142/1241) diff --git a/docs/src/dispersion.md b/docs/src/dispersion.md index af78dc4fd..54dcdd7b4 100644 --- a/docs/src/dispersion.md +++ b/docs/src/dispersion.md @@ -88,9 +88,9 @@ function initial_condition_traveling_wave(x, t, equations, mesh) omega = frequency(k) h0 = reference_height() A = 0.02 - h = A * cos(k * x - omega * t) - v = sqrt(equations.gravity / k * tanh(k * h0)) * h / h0 - eta = h + equations.eta0 + eta_prime = A * cos(k * x - omega * t) + v = sqrt(equations.gravity / k * tanh(k * h0)) * eta_prime / h0 + eta = eta_prime + equations.eta0 D = h0 return SVector(eta, v, D) end diff --git a/docs/src/overview.md b/docs/src/overview.md index ab44c27eb..b81cd0c04 100644 --- a/docs/src/overview.md +++ b/docs/src/overview.md @@ -22,12 +22,11 @@ The following table provides an overview of all available equation systems and t ![water height and bathymetry](bathymetry.png) - ``\eta``: Total water height -- ``v``: Velocity in horizontal direction +- ``v``: Velocity in horizontal direction - ``D``: Still-water depth - ``w``: Auxiliary variable in hyperbolic approximation (``\approx -h v_x``) - ``H``: Auxiliary variable in hyperbolic approximation (``\approx h``) - ## Abstract Shallow Water Equations Interface Several equation systems in [DispersiveShallowWater.jl](https://github.com/NumericalMathematics/DispersiveShallowWater.jl) (`BBMBBMEquations1D`, `SvaerdKalischEquations1D`, `SerreGreenNaghdiEquations1D`, and `HyperbolicSerreGreenNaghdiEquations1D`) are subtypes of [`AbstractShallowWaterEquations`](@ref). This design reflects that these systems all contain the classical shallow water equations as a subsystem, extended with additional dispersive terms. diff --git a/docs/src/plotting.md b/docs/src/plotting.md index f3db973e1..d01d8d37f 100644 --- a/docs/src/plotting.md +++ b/docs/src/plotting.md @@ -41,7 +41,7 @@ nothing # hide # [Plotting Simulation Results](@id plotting) -[DispersiveShallowWater.jl](https://github.com/NumericalMathematics/DispersiveShallowWater.jl) provides flexible plotting capabilities through [Plots.jl](https://github.com/JuliaPlots/Plots.jl) recipes. The plotting system supports various conversion functions, visualization options, and analysis tools. +[DispersiveShallowWater.jl](https://github.com/NumericalMathematics/DispersiveShallowWater.jl) provides flexible plotting capabilities through [Plots.jl](https://github.com/JuliaPlots/Plots.jl) recipes. The plotting system supports various conversion functions, visualization options, and analysis tools. [Makie.jl](https://docs.makie.org/stable/) is not supported yet. [Contributions are welcome](https://github.com/NumericalMathematics/DispersiveShallowWater.jl/issues/220). @@ -59,7 +59,7 @@ using Plots t = 13.37 # plot solution at (roughly) t = 13.37s step_idx = argmin(abs.(saveat .- t)) # get the closest point to 13.37 -p1 = plot(semi => sol, conversion = prim2prim, plot_bathymetry = false, +p1 = plot(semi => sol, conversion = prim2prim, plot_bathymetry = false, suptitle = "Primitive Variables", step = step_idx) p2 = plot(semi => sol, conversion = prim2cons, plot_bathymetry = false, suptitle = "Conservative Variables", step = step_idx) diff --git a/docs/src/solvers.md b/docs/src/solvers.md index f2eadd20d..158fa7b07 100644 --- a/docs/src/solvers.md +++ b/docs/src/solvers.md @@ -42,7 +42,8 @@ solver = Solver(D1, D2, D3) ``` where: -- `D1` is always required and must be an `AbstractDerivativeOperator` + +- `D1` is always required and must be an `AbstractDerivativeOperator` - `D2` and `D3` are optional and can be either `AbstractDerivativeOperator`s, `AbstractMatrix`es, or `nothing` ## Reflecting Boundary Conditions @@ -68,6 +69,7 @@ Other possible choices for sources can be found in the [documentation of Summati For equations that benefit from upwind discretizations (such as the Serre-Green-Naghdi equations), you can use [upwind SBP Operators](@ref upwind_sbp): **For periodic boundary conditions:** + ```julia using SummationByPartsOperators: upwind_operators, periodic_derivative_operator @@ -81,6 +83,7 @@ solver = Solver(D1) ``` **For reflecting boundary conditions:** + ```julia using SummationByPartsOperators: Mattsson2017, upwind_operators @@ -197,6 +200,7 @@ semi = Semidiscretization(mesh, equations, initial_condition, solver, ``` The solver you choose should be compatible with your boundary conditions: + - Periodic operators (created with `periodic_derivative_operator` or `fourier_derivative_operator`) require `boundary_condition_periodic` - Non-periodic operators (created with `MattssonNordström2004`, etc.) are needed for `boundary_condition_reflecting` @@ -205,6 +209,7 @@ The solver you choose should be compatible with your boundary conditions: ### Mismatched Operators and Boundary Conditions **Problem**: Using periodic operators with reflecting boundary conditions or vice versa. + ```julia # ❌ This will fail D1 = periodic_derivative_operator(1, 4, mesh.xmin, mesh.xmax, mesh.N) @@ -214,9 +219,10 @@ semi = Semidiscretization(mesh, equations, initial_condition, solver, ``` **Solution**: Match operator type to boundary conditions: + ```julia # ✅ Correct approach -D1 = derivative_operator(MattssonNordström2004(), derivative_order = 1, +D1 = derivative_operator(MattssonNordström2004(), derivative_order = 1, accuracy_order = 4, xmin = mesh.xmin, xmax = mesh.xmax, N = mesh.N) solver = Solver(D1) semi = Semidiscretization(mesh, equations, initial_condition, solver, @@ -226,6 +232,7 @@ semi = Semidiscretization(mesh, equations, initial_condition, solver, ### Incorrect Grid Size for DG Methods **Problem**: Grid size not divisible by polynomial degree + 1 for DG methods. + ```julia # ❌ N = 101, p = 3, but 101 is not divisible by (3+1) = 4 N = 101 @@ -234,6 +241,7 @@ mesh = Mesh1D(coordinates_min, coordinates_max, N) # Error in DG setup! ``` **Solution**: Ensure `N` is divisible by `p + 1`: + ```julia # ✅ Adjust N to be divisible by p + 1 p = 3 diff --git a/examples/hyperbolic_serre_green_naghdi_1d/hyperbolic_serre_green_naghdi_dingemans.jl b/examples/hyperbolic_serre_green_naghdi_1d/hyperbolic_serre_green_naghdi_dingemans.jl index e1e794727..7bcf3f881 100644 --- a/examples/hyperbolic_serre_green_naghdi_1d/hyperbolic_serre_green_naghdi_dingemans.jl +++ b/examples/hyperbolic_serre_green_naghdi_1d/hyperbolic_serre_green_naghdi_dingemans.jl @@ -6,7 +6,7 @@ using DispersiveShallowWater equations = HyperbolicSerreGreenNaghdiEquations1D(bathymetry_type = bathymetry_mild_slope, lambda = 500.0, - gravity = 9.81) + gravity = 9.81, eta0 = 0.8) initial_condition = initial_condition_dingemans boundary_conditions = boundary_condition_periodic diff --git a/examples/serre_green_naghdi_1d/serre_green_naghdi_dingemans.jl b/examples/serre_green_naghdi_1d/serre_green_naghdi_dingemans.jl index 194cc11cb..b76bb770e 100644 --- a/examples/serre_green_naghdi_1d/serre_green_naghdi_dingemans.jl +++ b/examples/serre_green_naghdi_1d/serre_green_naghdi_dingemans.jl @@ -7,7 +7,7 @@ using SummationByPartsOperators: upwind_operators, periodic_derivative_operator # or bathymetry_mild_slope instead of bathymetry_variable equations = SerreGreenNaghdiEquations1D(bathymetry_type = bathymetry_variable, - gravity = 9.81) + gravity = 9.81, eta0 = 0.8) initial_condition = initial_condition_dingemans boundary_conditions = boundary_condition_periodic diff --git a/src/equations/bbm_bbm_1d.jl b/src/equations/bbm_bbm_1d.jl index fe97d85ea..02d2cca9c 100644 --- a/src/equations/bbm_bbm_1d.jl +++ b/src/equations/bbm_bbm_1d.jl @@ -223,6 +223,8 @@ function source_terms_manufactured_reflecting(q, x, t, return SVector(s1, s2, zero(s1)) end +dingemans_calibration(equations::BBMBBMEquations1D) = 2.7 + """ initial_condition_dingemans(x, t, equations::BBMBBMEquations1D, mesh) @@ -249,12 +251,13 @@ function initial_condition_dingemans(x, t, equations::BBMBBMEquations1D, mesh) A = 0.02 # omega = 2*pi/(2.02*sqrt(2)) k = 0.8406220896381442 # precomputed result of find_zero(k -> omega^2 - g * k * tanh(k * h0), 1.0) using Roots.jl - if x < -30.5 * pi / k || x > -8.5 * pi / k - h = 0.0 + offset = dingemans_calibration(equations) + if x - offset < -34.5 * pi / k || x - offset > -4.5 * pi / k + eta_prime = 0.0 else - h = A * cos(k * x) + eta_prime = A * cos(k * (x - offset)) end - v = sqrt(g / k * tanh(k * h0)) * h / h0 + v = sqrt(g / k * tanh(k * h0)) * eta_prime / h0 if 11.01 <= x && x < 23.04 b = 0.6 * (x - 11.01) / (23.04 - 11.01) elseif 23.04 <= x && x < 27.04 @@ -264,9 +267,9 @@ function initial_condition_dingemans(x, t, equations::BBMBBMEquations1D, mesh) else b = 0.0 end - # Here, we compute eta - h0!! To obtain the original eta, h0 = 0.8 needs to be added again! + # Here, we compute eta - eta0!! To obtain the original eta, eta0 = 0.8 needs to be added again! # This is because the BBM-BBM equations are only implemented for eta0 = 0 - eta = h + eta = eta_prime D = h0 - b return SVector(eta, v, D) end diff --git a/src/equations/equations.jl b/src/equations/equations.jl index ab4955354..c9a1bb522 100644 --- a/src/equations/equations.jl +++ b/src/equations/equations.jl @@ -614,6 +614,10 @@ function solve_system_matrix!(dv, system_matrix, ::Union{BBMEquation1D, BBMBBMEq ldiv!(system_matrix, dv) end +# To match the experimental data from Dingemans, the initial condition needs to be shifted +# to account for the phase shift to the experimental data. +dingemans_calibration(equations) = 0 + """ initial_condition_dingemans(x, t, equations::AbstractShallowWaterEquations, mesh) @@ -635,12 +639,13 @@ function initial_condition_dingemans(x, t, equations::AbstractShallowWaterEquati A = 0.02 # omega = 2*pi/(2.02*sqrt(2)) k = 0.8406220896381442 # precomputed result of find_zero(k -> omega^2 - g * k * tanh(k * h0), 1.0) using Roots.jl - if x < -30.5 * pi / k || x > -8.5 * pi / k - h = 0.0 + offset = dingemans_calibration(equations) + if x - offset < -34.5 * pi / k || x - offset > -4.5 * pi / k + eta_prime = 0.0 else - h = A * cos(k * x) + eta_prime = A * cos(k * (x - offset)) end - v = sqrt(g / k * tanh(k * h0)) * h / h0 + v = sqrt(g / k * tanh(k * h0)) * eta_prime / h0 if 11.01 <= x && x < 23.04 b = 0.6 * (x - 11.01) / (23.04 - 11.01) elseif 23.04 <= x && x < 27.04 @@ -651,7 +656,7 @@ function initial_condition_dingemans(x, t, equations::AbstractShallowWaterEquati b = 0.0 end eta0 = equations.eta0 - eta = h + h0 + eta = eta_prime + eta0 D = eta0 - b return SVector(eta, v, D) end diff --git a/src/equations/hyperbolic_serre_green_naghdi_1d.jl b/src/equations/hyperbolic_serre_green_naghdi_1d.jl index d73eeece2..0c466c485 100644 --- a/src/equations/hyperbolic_serre_green_naghdi_1d.jl +++ b/src/equations/hyperbolic_serre_green_naghdi_1d.jl @@ -321,6 +321,8 @@ function source_terms_manufactured_reflecting(q, x, t, return SVector(s1, s2, s3, s4, s5) end +dingemans_calibration(equations::HyperbolicSerreGreenNaghdiEquations1D) = 2.4 + function create_cache(mesh, equations::HyperbolicSerreGreenNaghdiEquations1D, solver, initial_condition, boundary_conditions::Union{BoundaryConditionPeriodic, diff --git a/src/equations/serre_green_naghdi_1d.jl b/src/equations/serre_green_naghdi_1d.jl index a9daf3b57..6d3e7453c 100644 --- a/src/equations/serre_green_naghdi_1d.jl +++ b/src/equations/serre_green_naghdi_1d.jl @@ -414,7 +414,7 @@ function source_terms_manufactured_reflecting(q, x, t, cos3_pix = cospi(x)^3 cos4_pix = cospi(x)^4 - # Compute s1 + # Compute s1 s1 = 2(2 + cospix + x) + (-1 - 2(2 + cospix + x) * t) * sinpix * t - 2(1 - pi * sinpix) * sinpix * t2 * x + cospix * (-1 - 2(2 + cospix + x) * t) * pi * t * x @@ -496,6 +496,8 @@ function source_terms_manufactured_reflecting(q, x, t, return SVector(s1, s2, zero(s1)) end +dingemans_calibration(equations::SerreGreenNaghdiEquations1D) = 2.4 + # flat bathymetry with periodic or reflecting boundary conditions function create_cache(mesh, equations::SerreGreenNaghdiEquations1D{BathymetryFlat}, diff --git a/src/equations/svaerd_kalisch_1d.jl b/src/equations/svaerd_kalisch_1d.jl index 19edb595b..bd48cd598 100644 --- a/src/equations/svaerd_kalisch_1d.jl +++ b/src/equations/svaerd_kalisch_1d.jl @@ -197,6 +197,8 @@ function source_terms_manufactured_reflecting(q, x, t, equations::SvaerdKalischE return SVector(s1, s2, zero(s1)) end +dingemans_calibration(equations::SvaerdKalischEquations1D) = 2.2 + # For periodic boundary conditions function assemble_system_matrix!(cache, h, ::SvaerdKalischEquations1D, diff --git a/test/test_bbm_bbm_1d.jl b/test/test_bbm_bbm_1d.jl index e50b817e1..ea6f6d67c 100644 --- a/test/test_bbm_bbm_1d.jl +++ b/test/test_bbm_bbm_1d.jl @@ -296,12 +296,12 @@ end @testitem "bbm_bbm_1d_dingemans" setup=[Setup, BBMBBMEquation1D] begin @test_trixi_include(joinpath(EXAMPLES_DIR, "bbm_bbm_1d_dingemans.jl"), tspan=(0.0, 1.0), - l2=[0.22292157345226027 0.7504924411607958 0.0], - linf=[0.03584030574058168 0.1202292994661 0.0], - cons_error=[2.6129272356900657e-17 2.1141942363467336e-16 0.0], - change_waterheight=-2.6129272356900657e-17, - change_velocity=2.1141942363467336e-16, - change_entropy=3.4175334942543323e-7) + l2=[0.2609190317968624, 0.8783366794535071, 0.0], + linf=[0.035812250010499695, 0.12036148158978635, 0.0], + cons_error=[3.0948889826777626e-17, 2.233388712684359e-16, 0.0], + change_waterheight=3.0948889826777626e-17, + change_velocity=2.233388712684359e-16, + change_entropy=2.1764056595818815e-7) @test_allocations(DispersiveShallowWater.rhs!, semi, sol, allocs=10_000) end diff --git a/test/test_hyperbolic_serre_green_naghdi_1d.jl b/test/test_hyperbolic_serre_green_naghdi_1d.jl index 1761d1e1d..4fbff7f86 100644 --- a/test/test_hyperbolic_serre_green_naghdi_1d.jl +++ b/test/test_hyperbolic_serre_green_naghdi_1d.jl @@ -338,26 +338,28 @@ end "hyperbolic_serre_green_naghdi_dingemans.jl"), tspan=(0.0, 1.0), l2=[ - 0.22618134328164993, - 0.7376950780256356, - 3.389954422650516e-15, - 0.5105085009518094, - 0.2270170397315174 + 0.26477322527867336, + 0.8633746824236788, + 5.2597559566212386e-15, + 0.5966739911067777, + 0.26574526372150303 ], linf=[ - 0.03631632774349847, - 0.11854594481576813, - 3.497202527569243e-15, - 0.08108200376359903, - 0.03645317804157178 + 0.03634214058318297, + 0.1179926788229248, + 5.662137425588298e-15, + 0.0803729516282009, + 0.03647842275648405 ], - cons_error=[2.3874235921539366e-12, - 0.0006849904339648783, - 1.0658141036401503e-14, - 0.0356135949814768, - 0.00017701343821840965], - change_entropy=-0.0013486980525385661, - change_entropy_modified=-2.7995769187327824e-6) + cons_error=[ + 2.7569058147491887e-12, + 0.000940711448287545, + 0.0, + 0.048526294267482256, + 0.00024128430453629335 + ], + change_entropy=-0.0018582545795879923, + change_entropy_modified=-3.388064897080767e-6) @test_allocations(DispersiveShallowWater.rhs!, semi, sol, allocs=1_000) end diff --git a/test/test_serre_green_naghdi_1d.jl b/test/test_serre_green_naghdi_1d.jl index 2cd13f000..a67324bf6 100644 --- a/test/test_serre_green_naghdi_1d.jl +++ b/test/test_serre_green_naghdi_1d.jl @@ -239,12 +239,12 @@ end @test_trixi_include(joinpath(EXAMPLES_DIR, "serre_green_naghdi_dingemans.jl"), tspan=(0.0, 1.0), - l2=[0.22632930215585131, 0.7400070292134782, 0.0], - linf=[0.036351214376643126, 0.11899056101300992, 0.0], - cons_error=[1.4210854715202004e-13, 3.194346928167053e-5, 0.0], - change_waterheight=-1.4210854715202004e-13, - change_entropy=2.282635693973134e-5, - change_entropy_modified=-9.135646905633621e-9) + l2=[0.26494495802569085, 0.8661032949835936, 0.0], + linf=[0.036376471205494365, 0.11852616155632931, 0.0], + cons_error=[5.684341886080802e-14, 3.9150390196156476e-5, 0.0], + change_waterheight=-5.684341886080802e-14, + change_entropy=3.502228457819001e-5, + change_entropy_modified=-1.165130925073754e-8) @test_allocations(DispersiveShallowWater.rhs!, semi, sol, allocs=750_000) end @@ -257,12 +257,12 @@ end "serre_green_naghdi_dingemans.jl"), tspan=(0.0, 1.0), bathymetry_type=bathymetry_mild_slope, - l2=[0.22632930215585131, 0.7400070292134782, 0.0], - linf=[0.036351214376643126, 0.11899056101300992, 0.0], - cons_error=[1.4210854715202004e-13, 3.194346928167053e-5, 0.0], - change_waterheight=-1.4210854715202004e-13, - change_entropy=2.282635693973134e-5, - change_entropy_modified=-9.135646905633621e-9) + l2=[0.26494495802569085, 0.8661032949835936, 0.0], + linf=[0.036376471205494365, 0.11852616155632931, 0.0], + cons_error=[5.684341886080802e-14, 3.915039019538843e-5, 0.0], + change_waterheight=-5.684341886080802e-14, + change_entropy=3.502228457819001e-5, + change_entropy_modified=-1.165130925073754e-8) @test_allocations(DispersiveShallowWater.rhs!, semi, sol, allocs=750_000) end diff --git a/test/test_svaerd_kalisch_1d.jl b/test/test_svaerd_kalisch_1d.jl index ac18a0c43..4d72e00f1 100644 --- a/test/test_svaerd_kalisch_1d.jl +++ b/test/test_svaerd_kalisch_1d.jl @@ -64,13 +64,12 @@ end @test_trixi_include(joinpath(EXAMPLES_DIR, "svaerd_kalisch_1d_dingemans.jl"), tspan=(0.0, 1.0), - N=512, - l2=[0.22796106962338855 0.7519327063662515 0.0], - linf=[0.036708347831218346 0.12141172207472928 0.0], - cons_error=[3.979039320256561e-13 4.937137540373564e-5 0.0], - change_waterheight=-3.979039320256561e-13, - change_entropy=-0.00024362648639453255, - change_entropy_modified=-6.311893230304122e-9) + l2=[0.26685829773477077, 0.8800952098489548, 0.0], + linf=[0.03665249779728463, 0.12048532901685113, 0.0], + cons_error=[8.526512829121202e-14, 6.496724002244977e-5, 0.0], + change_waterheight=-8.526512829121202e-14, + change_entropy=-0.0003347684281607144, + change_entropy_modified=-8.815959517960437e-9) @test_allocations(DispersiveShallowWater.rhs!, semi, sol, allocs=350_000) @@ -82,14 +81,13 @@ end @test_trixi_include(joinpath(EXAMPLES_DIR, "svaerd_kalisch_1d_dingemans.jl"), tspan=(0.0, 1.0), - N=512, solver=solver, - l2=[0.22796180766836865 0.7519296292874257 0.0], - linf=[0.036709492542750466 0.12104908724733915 0.0], - cons_error=[2.842170943040401e-14 4.9341465183441843e-5 0.0], - change_waterheight=-2.842170943040401e-14, - change_entropy=-0.00024270962080663594, - change_entropy_modified=-7.430799087160267e-9) + l2=[0.2668587324501861, 0.8800918552821204, 0.0], + linf=[0.03665281298157985, 0.12092636417680247, 0.0], + cons_error=[1.1368683772161603e-13, 6.498269475070908e-5, 0.0], + change_waterheight=-1.1368683772161603e-13, + change_entropy=-0.00033396742981040006, + change_entropy_modified=-9.819814295042306e-9) @test_allocations(DispersiveShallowWater.rhs!, semi, sol, allocs=350_000) end @@ -98,12 +96,12 @@ end @test_trixi_include(joinpath(EXAMPLES_DIR, "svaerd_kalisch_1d_dingemans_cg.jl"), tspan=(0.0, 1.0), - l2=[0.22798490823942433 0.7520004851600044 0.0], - linf=[0.03673010870720128 0.12074632168110239 0.0], - cons_error=[1.4210854715202004e-13 4.953054817174909e-5 0.0], - change_waterheight=-1.4210854715202004e-13, - change_entropy=-0.0002425303440531934, - change_entropy_modified=-2.6815314413397573e-9) + l2=[0.2669280328828958, 0.8803010025365813, 0.0], + linf=[0.03678993282064258, 0.12097067363770743, 0.0], + cons_error=[1.7053025658242404e-13, 6.420678045948553e-5, 0.0], + change_waterheight=-1.7053025658242404e-13, + change_entropy=-0.0003283147891579574, + change_entropy_modified=-1.8083028408000246e-9) @test_allocations(DispersiveShallowWater.rhs!, semi, sol, allocs=750_000) end @@ -112,12 +110,12 @@ end @test_trixi_include(joinpath(EXAMPLES_DIR, "svaerd_kalisch_1d_dingemans_fourier.jl"), tspan=(0.0, 1.0), - l2=[0.22799246923254327 0.7520172891302948 0.0], - linf=[0.03671494177483947 0.12129171577180138 0.0], - cons_error=[8.526512829121202e-14 5.3078570574495334e-5 0.0], - change_waterheight=-8.526512829121202e-14, - change_entropy=-0.0002424441479433881, - change_entropy_modified=-4.00007138523506e-9) + l2=[0.2668948282001354, 0.8801953155243658, 0.0], + linf=[0.03665936863729946, 0.12083125907877076, 0.0], + cons_error=[1.1368683772161603e-13, 6.61417489483421e-5, 0.0], + change_waterheight=-1.1368683772161603e-13, + change_entropy=-0.00033368459492066904, + change_entropy_modified=-7.291419024113566e-9) @test_allocations(DispersiveShallowWater.rhs!, semi, sol, allocs=13_000_000) end @@ -126,12 +124,12 @@ end @test_trixi_include(joinpath(EXAMPLES_DIR, "svaerd_kalisch_1d_dingemans_upwind.jl"), tspan=(0.0, 1.0), - l2=[0.2280370308166863 0.7521344942401095 0.0], - linf=[0.03673101553812019 0.12116306036094074 0.0], - cons_error=[1.1368683772161603e-13 4.871598417571836e-5 0.0], - change_waterheight=-1.1368683772161603e-13, - change_entropy=-0.00023645232727176335, - change_entropy_modified=-6.654090611846186e-9) + l2=[0.26694765330284975, 0.8803371688530466, 0.0], + linf=[0.036669553278771194, 0.1212379289727636, 0.0], + cons_error=[5.684341886080802e-14, 6.444827576975179e-5, 0.0], + change_waterheight=-5.684341886080802e-14, + change_entropy=-0.00032897021856115316, + change_entropy_modified=-9.04344688024139e-9) @test_allocations(DispersiveShallowWater.rhs!, semi, sol, allocs=350_000) end @@ -140,12 +138,11 @@ end @test_trixi_include(joinpath(EXAMPLES_DIR, "svaerd_kalisch_1d_dingemans_relaxation.jl"), tspan=(0.0, 1.0), - N=512, - l2=[0.22796107242561717 0.7519327155905444 0.0], - linf=[0.03670834831604197 0.12141172368792873 0.0], - cons_error=[3.979039320256561e-13 4.937137655207271e-5 0.0], - change_waterheight=-3.979039320256561e-13, - change_entropy=-0.00024362054875837202, + l2=[0.2668583011029348, 0.8800952209358568, 0.0], + linf=[0.03665249830112549, 0.12048533060761354, 0.0], + cons_error=[8.526512829121202e-14, 6.4967241631659e-5, 0.0], + change_waterheight=-8.526512829121202e-14, + change_entropy=-0.000334760128112066, change_entropy_modified=0.0) @test_allocations(DispersiveShallowWater.rhs!, semi, sol, allocs=350_000)