Skip to content

Commit

Permalink
ghost test
Browse files Browse the repository at this point in the history
Signed-off-by: thanasis@Dobby <giannakopoulos.th@gmail.com>
  • Loading branch information
ThanasisGiannakopoulos committed Dec 17, 2024
1 parent 312109b commit 882b481
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 2 deletions.
5 changes: 3 additions & 2 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ using Test
using SpheriCo

# Include other test files
include("test_FD2.jl")
include("test_SBP.jl")
include("test_ghosts.jl")
include("test_FD2.jl")
include("test_SBP.jl")
30 changes: 30 additions & 0 deletions test/test_ghosts.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using Test
using SpheriCo

@testset "ghost tests" begin

# change D for number of points
D = 4
Nr = (128)*2^D + 1 + 2 # +1 for last point, + 2 for ghosts left of r=0
# positions of outer boundary
rmax = 10
# radial grid
g = Grid(
# discretization parameters
Nr = Nr,
r_max = rmax
)

# generate random data
f = rand(Nr)
g = rand(Nr)

# populate ghosts on the left of r=0
f = even_ghosts(f)
g = odd_ghosts(g)

@test abs(f[4]-f[2]) < 1e-16
@test abs(f[5]-f[1]) < 1e-16
@test abs(g[4]+g[2]) < 1e-16
@test abs(g[5]+g[1]) < 1e-16
end

0 comments on commit 882b481

Please sign in to comment.