Skip to content

Commit ab09b24

Browse files
committed
add tests
1 parent fd849ec commit ab09b24

File tree

2 files changed

+73
-0
lines changed

2 files changed

+73
-0
lines changed

test/test_tree_1d.jl

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1154,6 +1154,29 @@ end # SWE-Exner
11541154
@test_allocations(Trixi.rhs!, semi, sol, 1000)
11551155
end
11561156
end # SWME
1157+
1158+
@testset "Hyperbolic Sainte-Marie Equations" begin
1159+
@trixi_testset "elixir_hyperbolic_sainte_marie_ec.jl" begin
1160+
@test_trixi_include(joinpath(EXAMPLES_DIR,
1161+
"elixir_hyperbolic_sainte_marie_ec.jl"),
1162+
l2=[
1163+
1.0441454360043452,
1164+
2.5582468792214086,
1165+
4.125808227717679,
1166+
10.814871283792858,
1167+
8.077199796761241e-10
1168+
],
1169+
linf=[
1170+
2.319148117407863,
1171+
8.969819026592885,
1172+
7.698519878211499,
1173+
24.656638862610052,
1174+
3.279725713234427e-9
1175+
])
1176+
# Allocation testing is disabled as the symbolic source term computation is known to cause
1177+
# allocations.
1178+
end
1179+
end # HYPSM
11571180
end # TreeMesh1D
11581181

11591182
# Clean up afterwards: delete TrixiShallowWater.jl output directory

test/test_type.jl

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,5 +291,55 @@ isdir(outdir) && rm(outdir, recursive = true)
291291
@test typeof(@inferred lake_at_rest_error(u, equations)) == RealT
292292
end
293293
end
294+
@timed_testset "Hyperbolic Sainte-Marie Equations 1D" begin
295+
for RealT in (Float32, Float64)
296+
equations = @inferred HyperbolicSainteMarieEquations1D(gravity = RealT(9.81),
297+
b0 = RealT(0.1))
298+
299+
x = SVector(zero(RealT))
300+
t = zero(RealT)
301+
u = u_ll = u_rr = u_inner = cons = SVector(one(RealT), one(RealT), one(RealT))
302+
orientation = 1
303+
directions = [1, 2]
304+
normal_direction = SVector(one(RealT))
305+
alpha_coefficients = RealT.((1 / 2, 1.0, 2 / 3))
306+
surface_flux_functions = (flux_conservative_artiano_ranocha(alpha_coefficients...),
307+
flux_nonconservative_artiano_ranocha(alpha_coefficients...))
308+
dissipation = DissipationLocalLaxFriedrichs()
309+
numflux = FluxHLL()
310+
311+
@test eltype(@inferred initial_condition_convergence_test(x, t, equations)) ==
312+
RealT
313+
@test eltype(@inferred initial_condition_weak_blast_wave(x, t, equations)) ==
314+
RealT
315+
@test eltype(@inferred source_terms_convergence_test(u, x, t, equations)) ==
316+
RealT
317+
318+
for direction in directions
319+
@test eltype(@inferred boundary_condition_slip_wall(u_inner,
320+
orientation,
321+
direction,
322+
x, t,
323+
surface_flux_functions,
324+
equations)) ==
325+
SVector{5, RealT}
326+
end
327+
328+
@test eltype(@inferred surface_flux_functions[1](u_ll, u_rr, orientation,
329+
equations)) == RealT
330+
@test eltype(@inferred surface_flux_functions[2](u_ll, u_rr, orientation,
331+
equations)) == RealT
332+
333+
@test eltype(@inferred Trixi.max_abs_speeds(u, equations)) == RealT
334+
335+
@test typeof(@inferred velocity(u, equations)) == RealT
336+
@test eltype(@inferred cons2prim(u, equations)) == RealT
337+
@test eltype(@inferred prim2cons(u, equations)) == RealT
338+
@test eltype(@inferred cons2entropy(u, equations)) == RealT
339+
@test typeof(@inferred entropy(cons, equations)) == RealT
340+
@test typeof(@inferred energy_total(cons, equations)) == RealT
341+
@test typeof(@inferred lake_at_rest_error(u, equations)) == RealT
342+
end
343+
end
294344
end
295345
end # module

0 commit comments

Comments
 (0)