comparison test/testSbpOperators.jl @ 632:bf8b66c596f7 feature/volume_and_boundary_operators

Use operator with odd parity in test for VolumeOpertors
author Vidar Stiernström <vidar.stiernstrom@it.uu.se>
date Thu, 31 Dec 2020 08:41:07 +0100
parents fb915bce2228
children fb5ac62563aa
comparison
equal deleted inserted replaced
631:fb915bce2228 632:bf8b66c596f7
197 end 197 end
198 end 198 end
199 199
200 # TODO: Test for other dimensions? 200 # TODO: Test for other dimensions?
201 op_x = volume_operator(g_2D,inner_stencil,closure_stencils,Parity(1),1) 201 op_x = volume_operator(g_2D,inner_stencil,closure_stencils,Parity(1),1)
202 op_y = volume_operator(g_2D,inner_stencil,closure_stencils,Parity(1),2) 202 op_y = volume_operator(g_2D,inner_stencil,closure_stencils,Parity(-1),2)
203 v = zeros(size(g_2D)) 203 v = zeros(size(g_2D))
204 Nx = size(g_2D)[1] 204 Nx = size(g_2D)[1]
205 Ny = size(g_2D)[2]
205 for i = 1:Nx 206 for i = 1:Nx
206 v[i,:] .= i 207 v[i,:] .= i
207 end 208 end
208 rx = copy(v) 209 rx = copy(v)
209 rx[1,:] .= 1.5 210 rx[1,:] .= 1.5
210 rx[end,:] .= (2*Nx-1)/2 211 rx[Nx,:] .= (2*Nx-1)/2
211 ry = copy(v) 212 ry = copy(v)
213 ry[:,Ny-1:Ny] = -v[:,Ny-1:Ny]
212 214
213 @testset "Application" begin 215 @testset "Application" begin
214 @test op_x*v ≈ rx rtol = 1e-14 216 @test op_x*v ≈ rx rtol = 1e-14
215 @test op_y*v ≈ ry rtol = 1e-14 217 @test op_y*v ≈ ry rtol = 1e-14
216 end 218 end