Skip to content

Commit

Permalink
calc_volume_integral! for all meshes supported by fv_kernel! (#2014)
Browse files Browse the repository at this point in the history
* calc_volume_integral! for all meshes supported by fv_kernel!

* test p4est and t8code

* Update test/test_p4est_2d.jl

* fmt

* remove coverage line

---------

Co-authored-by: Hendrik Ranocha <[email protected]>
  • Loading branch information
DanielDoehring and ranocha authored Jul 24, 2024
1 parent 79fc319 commit e5f4cbe
Show file tree
Hide file tree
Showing 6 changed files with 93 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/solvers/dgsem_tree/dg_1d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ end

# TODO: Taal dimension agnostic
function calc_volume_integral!(du, u,
mesh::TreeMesh{1},
mesh::Union{TreeMesh{1}, StructuredMesh{1}},
nonconservative_terms, equations,
volume_integral::VolumeIntegralPureLGLFiniteVolume,
dg::DGSEM, cache)
Expand Down
4 changes: 3 additions & 1 deletion src/solvers/dgsem_tree/dg_2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,9 @@ end

# TODO: Taal dimension agnostic
function calc_volume_integral!(du, u,
mesh::TreeMesh{2},
mesh::Union{TreeMesh{2}, StructuredMesh{2},
UnstructuredMesh2D, P4estMesh{2},
T8codeMesh{2}},
nonconservative_terms, equations,
volume_integral::VolumeIntegralPureLGLFiniteVolume,
dg::DGSEM, cache)
Expand Down
3 changes: 2 additions & 1 deletion src/solvers/dgsem_tree/dg_3d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,8 @@ end

# TODO: Taal dimension agnostic
function calc_volume_integral!(du, u,
mesh::TreeMesh{3},
mesh::Union{TreeMesh{3}, StructuredMesh{3}, P4estMesh{3},
T8codeMesh{3}},
nonconservative_terms, equations,
volume_integral::VolumeIntegralPureLGLFiniteVolume,
dg::DGSEM, cache)
Expand Down
29 changes: 29 additions & 0 deletions test/test_p4est_2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -655,6 +655,35 @@ end
@test isapprox(lift, 0.029076443678087403, atol = 1e-13)
@test isapprox(drag, 0.13564720009197903, atol = 1e-13)
end

@trixi_testset "elixir_euler_blast_wave_pure_fv.jl" begin
@test_trixi_include(joinpath(pkgdir(Trixi, "examples", "tree_2d_dgsem"),
"elixir_euler_blast_wave_pure_fv.jl"),
l2=[
0.39957047631960346,
0.21006912294983154,
0.21006903549932,
0.6280328163981136,
],
linf=[
2.20417889887697,
1.5487238480003327,
1.5486788679247812,
2.4656795949035857,
],
tspan=(0.0, 0.5),
mesh=P4estMesh((64, 64), polydeg = 3,
coordinates_min = (-2.0, -2.0),
coordinates_max = (2.0, 2.0)))
# 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
end

# Clean up afterwards: delete Trixi.jl output directory
Expand Down
24 changes: 24 additions & 0 deletions test/test_structured_1d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,30 @@ end
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
end
end

@trixi_testset "elixir_euler_convergence_pure_fv.jl" begin
@test_trixi_include(joinpath(pkgdir(Trixi, "examples", "tree_1d_dgsem"),
"elixir_euler_convergence_pure_fv.jl"),
mesh=StructuredMesh(16, (0.0,), (2.0,)),
l2=[
0.019355699748523896,
0.022326984561234497,
0.02523665947241734,
],
linf=[
0.02895961127645519,
0.03293442484199227,
0.04246098278632804,
])
# 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
end

# Clean up afterwards: delete Trixi.jl output directory
Expand Down
34 changes: 34 additions & 0 deletions test/test_t8code_3d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,40 @@ mkdir(outdir)
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
end
end

@trixi_testset "elixir_euler_convergence_pure_fv.jl" begin
@test_trixi_include(joinpath(pkgdir(Trixi, "examples", "tree_3d_dgsem"),
"elixir_euler_convergence_pure_fv.jl"),
l2=[
0.037182410351406,
0.032062252638283974,
0.032062252638283974,
0.03206225263828395,
0.12228177813586687,
],
linf=[
0.0693648413632646,
0.0622101894740843,
0.06221018947408474,
0.062210189474084965,
0.24196451799555962,
],
mesh=T8codeMesh((4, 4, 4), polydeg = 3,
coordinates_min = (0.0, 0.0, 0.0),
coordinates_max = (2.0, 2.0, 2.0)),
# Remove SaveSolution callback
callbacks=CallbackSet(summary_callback,
analysis_callback, alive_callback,
stepsize_callback))
# 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
end

# Clean up afterwards: delete Trixi.jl output directory
Expand Down

0 comments on commit e5f4cbe

Please sign in to comment.