Skip to content

Commit

Permalink
Fix sign error in 3D DGMultiFDSBP elixir (trixi-framework#2164)
Browse files Browse the repository at this point in the history
* fix sign error

* add threaded test

* Update test_threaded.jl

* Update test_threaded.jl for formatting

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update src/solvers/dgmulti/sbp.jl

Co-authored-by: Daniel Doehring <[email protected]>

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Hendrik Ranocha <[email protected]>
Co-authored-by: Daniel Doehring <[email protected]>
  • Loading branch information
4 people authored Nov 16, 2024
1 parent 646f8d5 commit 9c2f326
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/solvers/dgmulti/sbp.jl
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,10 @@ function calc_volume_integral!(du, u, mesh::DGMultiMesh,
for id in nzrange(A_base, i)
j = rows[id]
u_j = u[j]
A_ij = vals[id]

# we use the negative of A_ij since A is skew-symmetric,
# and we are accessing the transpose of A.
A_ij = -vals[id]
AF_ij = 2 * A_ij *
volume_flux(u_i, u_j, normal_direction, equations)
du_i = du_i + AF_ij
Expand Down
29 changes: 28 additions & 1 deletion test/test_threaded.jl
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ end
end
end

@trixi_testset "elixir_euler_fdsbp_periodic.jl" begin
@trixi_testset "elixir_euler_fdsbp_periodic.jl (2D)" begin
@test_trixi_include(joinpath(examples_dir(), "dgmulti_2d",
"elixir_euler_fdsbp_periodic.jl"),
l2=[
Expand All @@ -467,6 +467,33 @@ end
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 5000
end
end

@trixi_testset "elixir_euler_fdsbp_periodic.jl (3D)" begin
@test_trixi_include(joinpath(examples_dir(),
"dgmulti_3d/elixir_euler_fdsbp_periodic.jl"),
l2=[
7.561896970325353e-5,
6.884047859361093e-5,
6.884047859363204e-5,
6.884047859361148e-5,
0.000201107274617457
],
linf=[
0.0001337520020225913,
0.00011571467799287305,
0.0001157146779990903,
0.00011571467799376123,
0.0003446082308800058
])
# 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
end

Expand Down

0 comments on commit 9c2f326

Please sign in to comment.