Skip to content

Commit

Permalink
Fix typo in analytical solution of BBM-BBM equations (#30)
Browse files Browse the repository at this point in the history
* fix typo in analytical solution of BBM-BBM equations

* higher tolerance

* fix
  • Loading branch information
JoshuaLampert authored Sep 2, 2023
1 parent 78f48a2 commit aaad0f9
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 20 deletions.
10 changes: 5 additions & 5 deletions src/equations/bbm_bbm_1d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ For details see Example 5 in Section 3 from (here adapted for dimensional equati
"""
function initial_condition_convergence_test(x, t, equations::BBMBBMEquations1D, mesh)
g = equations.gravity
c = 5 / 2
rho = 18 / 5 * sqrt(equations.D * g)
c = 5 / 2 * sqrt(equations.D * g)
rho = 18 / 5
x_t = mod(x - c * t - xmin(mesh), xmax(mesh) - xmin(mesh)) + xmin(mesh)

b = 0.5 * sqrt(rho) * x_t / equations.D
theta = 0.5 * sqrt(rho) * x_t / equations.D
eta = -equations.D + c^2 * rho^2 / (81 * g) +
5 * c^2 * rho^2 / (108 * g) * (2 / cosh(b)^2 - 3 / cosh(b)^4)
v = c * (1 - 5 * rho / 18) + 5 * c * rho / 6 / cosh(b)^2
5 * c^2 * rho^2 / (108 * g) * (2 * sech(theta)^2 - 3 * sech(theta)^4)
v = c * (1 - 5 * rho / 18) + 5 * c * rho / 6 * sech(theta)^2
return SVector(eta, v)
end

Expand Down
10 changes: 5 additions & 5 deletions src/equations/bbm_bbm_variable_bathymetry_1d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,14 @@ function initial_condition_convergence_test(x,
mesh)
g = equations.gravity
D = 2.0 # constant bathymetry in this case
c = 5 / 2
rho = 18 / 5 * sqrt(D * g)
c = 5 / 2 * sqrt(D * g)
rho = 18 / 5
x_t = mod(x - c * t - xmin(mesh), xmax(mesh) - xmin(mesh)) + xmin(mesh)

b = 0.5 * sqrt(rho) * x_t / D
theta = 0.5 * sqrt(rho) * x_t / D
eta = -D + c^2 * rho^2 / (81 * g) +
5 * c^2 * rho^2 / (108 * g) * (2 / cosh(b)^2 - 3 / cosh(b)^4)
v = c * (1 - 5 * rho / 18) + 5 * c * rho / 6 / cosh(b)^2
5 * c^2 * rho^2 / (108 * g) * (2 * sech(theta)^2 - 3 * sech(theta)^4)
v = c * (1 - 5 * rho / 18) + 5 * c * rho / 6 * sech(theta)^2
return SVector(eta, v, D)
end

Expand Down
11 changes: 6 additions & 5 deletions test/test_bbm_bbm_1d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@ EXAMPLES_DIR = joinpath(examples_dir(), "bbm_bbm_1d")
@trixi_testset "bbm_bbm_1d_basic" begin
@test_trixi_include(joinpath(EXAMPLES_DIR, "bbm_bbm_1d_basic.jl"),
tspan=(0.0, 1.0),
l2=[0.018736231276083863 0.02772945798792677],
linf=[0.016366252270215174 0.0211147869206485],
l2=[0.003249079018874934 0.007190714378932064],
linf=[0.0027187328947428924 0.0037427924312432026],
cons_error=[2.234687408354354e-13 5.684341886080801e-13],
change_waterheight=2.2222469560301384e-13,
change_velocity=-5.684341886080801e-13,
change_entropy=3.729011405084748e-5)
change_entropy=0.0003910017421731027,
atol_ints=1e-10) # in order to make CI pass
end

@trixi_testset "bbm_bbm_1d_dg" begin
Expand All @@ -33,8 +34,8 @@ EXAMPLES_DIR = joinpath(examples_dir(), "bbm_bbm_1d")
@trixi_testset "bbm_bbm_1d_relaxation" begin
@test_trixi_include(joinpath(EXAMPLES_DIR, "bbm_bbm_1d_relaxation.jl"),
tspan=(0.0, 1.0),
l2=[0.018736253012537167 0.02772912154768439],
linf=[0.016366092353111816 0.021114697353509015],
l2=[0.003248414414759437 0.007189120223695793],
linf=[0.002718237079326169 0.0037417143809364006],
cons_error=[2.259983767321016e-13 4.547473508864641e-13],
change_waterheight=2.1746572188776938e-13,
change_velocity=-4.547473508864641e-13,
Expand Down
6 changes: 3 additions & 3 deletions test/test_bbm_bbm_variable_bathymetry_1d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ EXAMPLES_DIR = joinpath(examples_dir(), "bbm_bbm_variable_bathymetry_1d")
@test_trixi_include(joinpath(EXAMPLES_DIR,
"bbm_bbm_variable_bathymetry_1d_basic.jl"),
tspan=(0.0, 1.0),
l2=[0.04346190082228665 0.11171710004736789 0.0],
linf=[0.04283944204214696 0.0953750884645661 0.0],
l2=[0.0024561065856105136 0.005467472679563469 0.0],
linf=[0.0019322426802252934 0.003270790905389731 0.0],
cons_error=[1.0394561372181596e-13 3.410605131648481e-13 0.0],
change_waterheight=1.0394561372181596e-13,
change_velocity=-3.410605131648481e-13,
change_entropy=0.06735422396923241)
change_entropy=0.001227743371600809)
end

@trixi_testset "bbm_bbm_variable_bathymetry_1d_relaxation" begin
Expand Down
4 changes: 2 additions & 2 deletions test/test_util.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ macro test_trixi_include(elixir, args...)
local lake_at_rest = get_kwarg(args, :lake_at_rest, nothing)
local atol = get_kwarg(args, :atol, 1e-12)
local rtol = get_kwarg(args, :rtol, sqrt(eps()))
local atol_ints = get_kwarg(args, :atol, 1e-11)
local rtol_ints = get_kwarg(args, :rtol, sqrt(eps()))
local atol_ints = get_kwarg(args, :atol_ints, 1e-11)
local rtol_ints = get_kwarg(args, :rtol_ints, sqrt(eps()))

local kwargs = Pair{Symbol, Any}[]
for arg in args
Expand Down

0 comments on commit aaad0f9

Please sign in to comment.