Skip to content

Commit

Permalink
Copy to host before testing
Browse files Browse the repository at this point in the history
  • Loading branch information
utkinis committed Mar 1, 2024
1 parent 429c7ce commit 35902e1
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions test/test_boundary_conditions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ for backend in backends
arch = Arch(backend)
grid = UniformGrid(arch; origin=(0.0, 0.0), extent=(1.0, 1.0), dims=(8, 8))
field = Field(arch, grid, (Center(), Vertex()))
field_i = interior(field; with_halo=true)

@testset "default Dirichlet" begin
set!(field, 1)
bc!(arch, grid, field => Dirichlet())
field_i = interior(field; with_halo=true) |> Array
@test all(field_i[1, 2:end-1] .≈ .-field_i[2, 2:end-1])
@test all(field_i[end, 2:end-1] .≈ .-field_i[end-1, 2:end-1])

Expand All @@ -25,6 +25,7 @@ for backend in backends
@testset "default Neumann" begin
set!(field, 1)
bc!(arch, grid, field => Neumann())
field_i = interior(field; with_halo=true) |> Array
@test all(field_i[1, 2:end-1] .≈ field_i[2, 2:end-1])
@test all(field_i[end, 2:end-1] .≈ field_i[end-1, 2:end-1])

Expand All @@ -36,9 +37,10 @@ for backend in backends
set!(field, 1)
v = 2.0
bc!(arch, grid, field => Dirichlet(v))
field_i = interior(field; with_halo=true) |> Array
@test all(field_i[1, 2:end-1] .≈ .-field_i[2, 2:end-1] .+ 2v)
@test all(field_i[end, 2:end-1] .≈ .-field_i[end-1, 2:end-1] .+ 2v)

@test all(field_i[2:end-1, 2] .≈ v)
@test all(field_i[2:end-1, end-1] .≈ v)
end
Expand All @@ -47,6 +49,7 @@ for backend in backends
set!(field, 1)
q = 2.0
bc!(arch, grid, field => Neumann(q))
field_i = interior(field; with_halo=true) |> Array
@test all((field_i[2, 2:end-1] .- field_i[1, 2:end-1]) ./ Δx(grid, Vertex(), 1, 1) .≈ q)
@test all((field_i[end, 2:end-1] .- field_i[end-1, 2:end-1]) ./ Δx(grid, Vertex(), 8, 1) .≈ q)

Expand Down

0 comments on commit 35902e1

Please sign in to comment.