Skip to content

Commit

Permalink
add tests to increase coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickersing committed Aug 12, 2024
1 parent aec40d8 commit 025ccc0
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/equations/shallow_water_exner_1d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ end
# Trigonometric version of Cardano's method to compute the eigenvalues of
# the [`ShallowWaterExnerEquations1D`[(@ref)] assuming only real roots.
@inline function eigvals_cardano(u, equations::ShallowWaterExnerEquations1D)
h, _, _ = u
h = waterheight(u, equations)
v = velocity(u, equations)
g = equations.gravity
r = equations.r
Expand Down
40 changes: 33 additions & 7 deletions test/test_tree_1d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -852,16 +852,16 @@ end # MLSWE
@test_trixi_include(joinpath(EXAMPLES_DIR,
"elixir_shallowwater_exner_source_terms_mpm.jl"),
l2=[
8.314469574617161e-5,
0.00037371557342261787,
2.8140625974847256e-5,
8.314340397306541e-5,
0.0003737050980420925,
2.81406288308791e-5,
],
linf=[
0.0003199264478970232,
0.0017104276669870355,
4.494237942265222e-5,
0.000319905497986106,
0.001710420951723135,
4.494237163465975e-5,
],
surface_flux=(FluxPlusDissipation(flux_ersing_etal,
surface_flux=(FluxPlusDissipation(flux_central,
dissipation_roe),
flux_nonconservative_ersing_etal))
# Ensure that we do not have excessive memory allocations
Expand Down Expand Up @@ -923,6 +923,32 @@ end # MLSWE
end
end

@trixi_testset "elixir_shallowwater_exner_well_balanced.jl with Roe dissipation" begin
@test_trixi_include(joinpath(EXAMPLES_DIR,
"elixir_shallowwater_exner_well_balanced.jl"),
l2=[
0.010910894511791577,
1.8877123431891935e-15,
0.010910894511791757,
],
linf=[
0.19999999999999674,
3.752915460516524e-15,
0.19999999999999998,
],
surface_flux=(FluxPlusDissipation(flux_ersing_etal,
dissipation_roe),
flux_nonconservative_ersing_etal))
# Ensure that we do not have excessive memory allocations
# (e.g., from type instabilities)
let
t = sol.t[end]
u_ode = sol.u[end]
du_ode = similar(u_ode)
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
end
end

@trixi_testset "elixir_shallowwater_exner_channel.jl" begin
@test_trixi_include(joinpath(EXAMPLES_DIR,
"elixir_shallowwater_exner_channel.jl"),
Expand Down

0 comments on commit 025ccc0

Please sign in to comment.