Skip to content

Commit 9c2f326

Browse files
jlchangithub-actions[bot]ranochaDanielDoehring
authored
Fix sign error in 3D DGMultiFDSBP elixir (#2164)
* 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]>
1 parent 646f8d5 commit 9c2f326

File tree

2 files changed

+32
-2
lines changed

2 files changed

+32
-2
lines changed

src/solvers/dgmulti/sbp.jl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,10 @@ function calc_volume_integral!(du, u, mesh::DGMultiMesh,
221221
for id in nzrange(A_base, i)
222222
j = rows[id]
223223
u_j = u[j]
224-
A_ij = vals[id]
224+
225+
# we use the negative of A_ij since A is skew-symmetric,
226+
# and we are accessing the transpose of A.
227+
A_ij = -vals[id]
225228
AF_ij = 2 * A_ij *
226229
volume_flux(u_i, u_j, normal_direction, equations)
227230
du_i = du_i + AF_ij

test/test_threaded.jl

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ end
442442
end
443443
end
444444

445-
@trixi_testset "elixir_euler_fdsbp_periodic.jl" begin
445+
@trixi_testset "elixir_euler_fdsbp_periodic.jl (2D)" begin
446446
@test_trixi_include(joinpath(examples_dir(), "dgmulti_2d",
447447
"elixir_euler_fdsbp_periodic.jl"),
448448
l2=[
@@ -467,6 +467,33 @@ end
467467
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 5000
468468
end
469469
end
470+
471+
@trixi_testset "elixir_euler_fdsbp_periodic.jl (3D)" begin
472+
@test_trixi_include(joinpath(examples_dir(),
473+
"dgmulti_3d/elixir_euler_fdsbp_periodic.jl"),
474+
l2=[
475+
7.561896970325353e-5,
476+
6.884047859361093e-5,
477+
6.884047859363204e-5,
478+
6.884047859361148e-5,
479+
0.000201107274617457
480+
],
481+
linf=[
482+
0.0001337520020225913,
483+
0.00011571467799287305,
484+
0.0001157146779990903,
485+
0.00011571467799376123,
486+
0.0003446082308800058
487+
])
488+
# Ensure that we do not have excessive memory allocations
489+
# (e.g., from type instabilities)
490+
let
491+
t = sol.t[end]
492+
u_ode = sol.u[end]
493+
du_ode = similar(u_ode)
494+
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
495+
end
496+
end
470497
end
471498
end
472499

0 commit comments

Comments
 (0)