comparison test/testSbpOperators.jl @ 706:19301615b340 feature/laplace_opset

Use the Laplace struct in tests for accuracy
author Vidar Stiernström <vidar.stiernstrom@it.uu.se>
date Mon, 15 Feb 2021 17:59:26 +0100
parents bf1387f867b8
children ee1808820929
comparison
equal deleted inserted replaced
705:bf1387f867b8 706:19301615b340
499 Δv = evalOn(g_3D,(x,y,z) -> -sin(x) - cos(y) + exp(z)) 499 Δv = evalOn(g_3D,(x,y,z) -> -sin(x) - cos(y) + exp(z))
500 500
501 # 2nd order interior stencil, 1st order boundary stencil, 501 # 2nd order interior stencil, 1st order boundary stencil,
502 # implies that L*v should be exact for binomials up to order 2. 502 # implies that L*v should be exact for binomials up to order 2.
503 @testset "2nd order" begin 503 @testset "2nd order" begin
504 L = laplace(g_3D,op2.innerStencil,op2.closureStencils) 504 L = Laplace(g_3D, sbp_operators_path()*"standard_diagonal.toml"; order=2)
505 @test L*polynomials[1] ≈ zeros(Float64, size(g_3D)...) atol = 5e-9 505 @test L*polynomials[1] ≈ zeros(Float64, size(g_3D)...) atol = 5e-9
506 @test L*polynomials[2] ≈ zeros(Float64, size(g_3D)...) atol = 5e-9 506 @test L*polynomials[2] ≈ zeros(Float64, size(g_3D)...) atol = 5e-9
507 @test L*polynomials[3] ≈ polynomials[1] atol = 5e-9 507 @test L*polynomials[3] ≈ polynomials[1] atol = 5e-9
508 @test L*v ≈ Δv rtol = 5e-2 norm = l2 508 @test L*v ≈ Δv rtol = 5e-2 norm = l2
509 end 509 end
510 510
511 # 4th order interior stencil, 2nd order boundary stencil, 511 # 4th order interior stencil, 2nd order boundary stencil,
512 # implies that L*v should be exact for binomials up to order 3. 512 # implies that L*v should be exact for binomials up to order 3.
513 @testset "4th order" begin 513 @testset "4th order" begin
514 op = read_D2_operator(sbp_operators_path()*"standard_diagonal.toml"; order=4) 514 L = Laplace(g_3D, sbp_operators_path()*"standard_diagonal.toml"; order=4)
515 L = laplace(g_3D,op4.innerStencil,op4.closureStencils)
516 # NOTE: high tolerances for checking the "exact" differentiation 515 # NOTE: high tolerances for checking the "exact" differentiation
517 # due to accumulation of round-off errors/cancellation errors? 516 # due to accumulation of round-off errors/cancellation errors?
518 @test L*polynomials[1] ≈ zeros(Float64, size(g_3D)...) atol = 5e-9 517 @test L*polynomials[1] ≈ zeros(Float64, size(g_3D)...) atol = 5e-9
519 @test L*polynomials[2] ≈ zeros(Float64, size(g_3D)...) atol = 5e-9 518 @test L*polynomials[2] ≈ zeros(Float64, size(g_3D)...) atol = 5e-9
520 @test L*polynomials[3] ≈ polynomials[1] atol = 5e-9 519 @test L*polynomials[3] ≈ polynomials[1] atol = 5e-9