Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test for BBMBBMEquations1D with upwind operators #105

Merged
merged 4 commits into from
May 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions test/test_bbm_bbm_1d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,35 @@ EXAMPLES_DIR = joinpath(examples_dir(), "bbm_bbm_1d")
change_velocity=-5.684341886080801e-13,
change_entropy=0.00019552914864107152,
atol_ints=1e-10) # in order to make CI pass

# test upwind operators
using SummationByPartsOperators: upwind_operators, periodic_derivative_operator
using SparseArrays: sparse
using OrdinaryDiffEq: solve
D1 = upwind_operators(periodic_derivative_operator; derivative_order = 1,
accuracy_order = accuracy_order, xmin = mesh.xmin,
xmax = mesh.xmax,
N = mesh.N)
D2 = sparse(D1.plus) * sparse(D1.minus)
solver = Solver(D1, D2)
semi = Semidiscretization(mesh, equations, initial_condition, solver,
boundary_conditions = boundary_conditions)
ode = semidiscretize(semi, (0.0, 1.0))
sol = solve(ode, Tsit5(), abstol = 1e-7, reltol = 1e-7,
save_everystep = false, callback = callbacks, saveat = saveat)
atol = 1e-12
rtol = 1e-12
errs = errors(analysis_callback)
l2 = [0.0024468371799030923 0.004954294234265212]
l2_measured = errs.l2_error[:, end]
for (l2_expected, l2_actual) in zip(l2, l2_measured)
@test isapprox(l2_expected, l2_actual, atol = atol, rtol = rtol)
end
linf = [0.002095653257311536 0.002611037468199129]
linf_measured = errs.linf_error[:, end]
for (linf_expected, linf_actual) in zip(linf, linf_measured)
@test isapprox(linf_expected, linf_actual, atol = atol, rtol = rtol)
end
end

@trixi_testset "bbm_bbm_1d_dg" begin
Expand Down
Loading