Skip to content

Commit

Permalink
add testing
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickersing committed Mar 13, 2024
1 parent 1c347a6 commit 91e1287
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 4 deletions.
15 changes: 11 additions & 4 deletions test/test_tree_1d_euler.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,17 @@ EXAMPLES_DIR = pkgdir(Trixi, "examples", "tree_1d_dgsem")
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
end
# Extra test to make sure the "TimeSeriesCallback" made correct data.
# Extracts data at all points from the first step of the time series and compares it to the exact solution.
point_data = [getindex(time_series.affect!.point_data[i], 1:3) for i=1:3]
ref_data = [initial_condition_convergence_test(time_series.affect!.point_coordinates[i], time_series.affect!.time[1], equations) for i=1:3]
@test point_data ref_data atol=1e-6
# Extracts data at all points from the first step of the time series and compares it to the
# exact solution and an interpolated reference solution
point_data = [getindex(time_series.affect!.point_data[i], 1:3) for i in 1:3]
exact_data = [initial_condition_convergence_test(time_series.affect!.point_coordinates[i],
time_series.affect!.time[1],
equations) for i in 1:3]
ref_data = [[1.968279088772251, 1.9682791565395945, 3.874122958278797],
[2.0654816955822017, 2.0654817326611883, 4.26621471136323],
[2.0317209235018936, 2.0317209516429506, 4.127889808862571]]
@test point_dataexact_data atol=1e-6
@test point_data ref_data
end

@trixi_testset "elixir_euler_convergence_pure_fv.jl" begin
Expand Down
32 changes: 32 additions & 0 deletions test/test_tree_3d_euler.jl
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,38 @@ EXAMPLES_DIR = pkgdir(Trixi, "examples", "tree_3d_dgsem")
du_ode = similar(u_ode)
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
end
# Extra test to make sure the "TimeSeriesCallback" made correct data.
# Extracts data at all points from the first step of the time series and compares it to the
# exact solution and an interpolated reference solution
point_data = [getindex(time_series.affect!.point_data[i], 1:5) for i in 1:3]
exact_data = [initial_condition_convergence_test(time_series.affect!.point_coordinates[:,
i],
time_series.affect!.time[1],
equations) for i in 1:3]
ref_data = [
[
1.9053441545123802,
1.9053448755267233,
1.905344875526724,
1.9053448755267266,
3.6303259410202022,
],
[
2.0956374376888744,
2.095637084878075,
2.0956370848780743,
2.095637084878072,
4.391698734498684,
],
[
2.0946764789674774,
2.0946781952809355,
2.094678195280935,
2.0946781952809324,
4.3876634952412505,
]]
@test point_dataexact_data atol=1e-1
@test point_data ref_data
end

@trixi_testset "elixir_euler_convergence_pure_fv.jl" begin
Expand Down

0 comments on commit 91e1287

Please sign in to comment.